Commit bd194cd1 by Damien Moulard Committed by Alexis Aoun

fix#2 days not covered

parent 7fc5c742
......@@ -950,11 +950,14 @@ function _compute_product_data(product) {
/* Coverage related data */
if (order_doc.coverage_days !== null) {
let qty_not_covered = product.daily_conso * order_doc.coverage_days - product.qty_available - product.incoming_qty - purchase_qty;
let days_not_covered = qty_not_covered / product.daily_conso; // get unmet needs in nb of days
days_not_covered = -Math.ceil(days_not_covered); // round up, so if a day is not fully covered display it
days_not_covered = (days_not_covered > 0) ? 0 : days_not_covered;
let days_not_covered = 0;
if (product.daily_conso !== 0) {
let qty_not_covered = product.daily_conso * order_doc.coverage_days - product.qty_available - product.incoming_qty - purchase_qty;
days_not_covered = qty_not_covered / product.daily_conso; // get unmet needs in nb of days
days_not_covered = -Math.ceil(days_not_covered); // round up, so if a day is not fully covered display it
days_not_covered = (days_not_covered > 0) ? 0 : days_not_covered;
}
item.days_not_covered = days_not_covered;
} else {
......
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