From 58e85bdec08f6f07afe7b8cdfaea6f7cef2776d1 Mon Sep 17 00:00:00 2001 From: mehdi-ghezal Date: Sun, 12 Nov 2017 10:37:08 +0100 Subject: [PATCH] [FIX] sale_stock: qty calculation in procurement creation When updating the qty on a confirmed sale order line, we want the system to add new procurement qty for the cancelled procurements. That way you can leave the cancelled procurements for what they are. --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 62b1598db66..f238511deb1 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -594,7 +594,7 @@ class SaleOrderLine(models.Model): if line.state != 'sale' or not line.product_id._need_procurement(): continue qty = 0.0 - for proc in line.procurement_ids: + for proc in line.procurement_ids.filtered(lambda r: r.state != 'cancel'): qty += proc.product_qty if float_compare(qty, line.product_uom_qty, precision_digits=precision) >= 0: continue