Commit cceb2530 by Damien Moulard Committed by Alexis Aoun

fix multi suppliers

parent bd7507a6
...@@ -423,7 +423,7 @@ function save_supplier_products(supplier, new_products) { ...@@ -423,7 +423,7 @@ function save_supplier_products(supplier, new_products) {
products.push(np); products.push(np);
} else { } else {
// Prevent adding ducplicate supplierinfo // Prevent adding ducplicate supplierinfo
let index_existing_supplierinfo = products[index].suppliersinfo.find(psi => psi.supplier_id == supplier.id); let index_existing_supplierinfo = products[index].suppliersinfo.findIndex(psi => psi.supplier_id == supplier.id);
if (index_existing_supplierinfo === -1) { if (index_existing_supplierinfo === -1) {
np_supplierinfo = np.suppliersinfo[0]; np_supplierinfo = np.suppliersinfo[0];
...@@ -951,6 +951,7 @@ function _compute_product_data(product) { ...@@ -951,6 +951,7 @@ function _compute_product_data(product) {
/* Coverage related data */ /* Coverage related data */
if (order_doc.coverage_days !== null) { if (order_doc.coverage_days !== null) {
let unmet_needs = product.daily_conso * order_doc.coverage_days - product.qty_available - product.incoming_qty - purchase_qty; let unmet_needs = product.daily_conso * order_doc.coverage_days - product.qty_available - product.incoming_qty - purchase_qty;
// TODO diviser tout ça par la conso moyenne pour avoir nb de jours
unmet_needs = -Math.round(unmet_needs); unmet_needs = -Math.round(unmet_needs);
unmet_needs = (unmet_needs > 0) ? 0 : unmet_needs; unmet_needs = (unmet_needs > 0) ? 0 : unmet_needs;
......
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