[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
This commit is contained in:
Nicolas Martinelli
2017-03-08 10:47:19 +01:00
parent 4ce309dfab
commit 218a21a37e
+1 -1
View File
@@ -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