Handle splitted stock entries + optimized/unified product property checks

This commit is contained in:
Bernd Bestel 2022-04-18 17:59:20 +02:00
parent 16f033afc5
commit cb5b739886
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -1058,12 +1058,12 @@ class StockService extends BaseService
$amount = 0;
}
if ($product->move_on_open)
if ($product->move_on_open == 1)
{
$locationIdTo = $product->default_consume_location_id;
if ($locationIdTo && $locationIdTo !== $stockEntry->location_id)
if (!empty($locationIdTo) && $locationIdTo != $stockEntry->location_id)
{
$this->TransferProduct($stockEntry->product_id, $amount, $stockEntry->location_id, $locationIdTo, $stockEntry->stock_id, $transactionId);
$this->TransferProduct($stockEntry->product_id, $stockEntry->amount, $stockEntry->location_id, $locationIdTo, $stockEntry->stock_id, $transactionId);
}
}
}