Commit ff876c1c by François C.

Merge branch '3985-alc-bad-coverage' into 'dev_cooperatic'

ALC: fix use of product minimal stock

See merge request !209
parents 90a84df1 c5954160
Pipeline #2444 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