diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 9fb74c96f83..f3faab74d21 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -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;