Skip to content

Commit

Permalink
NEW: Add global STOCK_MOVEMENT_FORCE_DO_NOT_CLEAN_EMPTY_LINES to forc…
Browse files Browse the repository at this point in the history
…e do not clean empty lines on movement stock. Because customer need to see the warehouse when the product previously even if the stock is at 0. And when in the reassort page, the product with a stock at 0 don't display and block the repleinishment of the stock of the product
  • Loading branch information
kkhelifa-opendsi committed Feb 14, 2024
1 parent 21098da commit 3f8db3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/product/stock/class/mouvementstock.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price =
}
}

if (empty($donotcleanemptylines)) {
if (empty($donotcleanemptylines) && !getDolGlobalInt('STOCK_MOVEMENT_FORCE_DO_NOT_CLEAN_EMPTY_LINES')) {
// If stock is now 0, we can remove entry into llx_product_stock, but only if there is no child lines into llx_product_batch (detail of batch, because we can imagine
// having a lot1/qty=X and lot2/qty=-X, so 0 but we must not loose repartition of different lot.
$sql = "DELETE FROM ".$this->db->prefix()."product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM ".$this->db->prefix()."product_batch as pb)";
Expand Down

0 comments on commit 3f8db3f

Please sign in to comment.