Merge pull request #20734 from lainwir3d/inventory_dont_use_batch_qty_20733

FIX #20733 Inventory: Do not use batch qty even if present if batch module is disabled.
This commit is contained in:
Laurent Destailleur 2022-05-01 12:25:01 +02:00 committed by GitHub
commit 6040bcfad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,9 +306,14 @@ class Inventory extends CommonObject
$inventoryline->fk_warehouse = $obj->fk_warehouse;
$inventoryline->fk_product = $obj->fk_product;
$inventoryline->batch = $obj->batch;
$inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty
$inventoryline->datec = dol_now();
if ($conf->productbatch->enabled) {
$inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty
} else {
$inventoryline->qty_stock = $obj->reel;
}
$resultline = $inventoryline->create($user);
if ($resultline <= 0) {
$this->error = $inventoryline->error;