From 218a21a37e6af2e2ba0e2b4d8d61d8d52a7547fc Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Mar 2017 10:47:19 +0100 Subject: [PATCH] [FIX] sale: do not run procurement twice When procurements are created, they are automatically run. Avoid this behavior, to run all procurements at the end of the process and used the optimized JIT behavior. opw-710007 --- 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 35db9cec6e6..83dcb3111df 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -596,7 +596,7 @@ class SaleOrderLine(models.Model): vals = line._prepare_order_line_procurement(group_id=line.order_id.procurement_group_id.id) vals['product_qty'] = line.product_uom_qty - qty - new_proc = self.env["procurement.order"].create(vals) + new_proc = self.env["procurement.order"].with_context(procurement_autorun_defer=True).create(vals) new_procs += new_proc new_procs.run() return new_procs