Commit c5954160 by Damien Moulard

ALC: fix use of product minimal stock

parent 0d624d73
Pipeline #2436 passed with stage
in 1 minute 25 seconds
......@@ -284,9 +284,13 @@ function compute_purchase_qty_for_coverage(product, coeff, stock, incoming_qty,
purchase_package_qty_for_coverage = 1;
} else {
purchase_qty_for_coverage = days * daily_conso - stock - incoming_qty + product.minimal_stock;
purchase_qty_for_coverage = days * daily_conso - stock - incoming_qty;
purchase_qty_for_coverage = (purchase_qty_for_coverage < 0) ? 0 : purchase_qty_for_coverage;
if (purchase_qty_for_coverage + stock + incoming_qty < product.minimal_stock) {
purchase_qty_for_coverage = product.minimal_stock - stock - incoming_qty;
}
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage = purchase_qty_for_coverage / product.suppliersinfo[0].package_qty;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment