From a8fa06867b708fcf64ed440c0971635a3728cffb Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 15 Oct 2015 16:41:23 +0200 Subject: [PATCH] [FIX] procurement_jit_stock: Cancelled MO To avoid running procurement in exception or cancel state. Before the fix: After cancelling a MO, when recreating the delivery order linked to the sale order in state "Shipping Exception" the system generated 2 more copies of MO (1 Extra) instead of just one for the cancelled MO. After the fix: Just one MO is recreated for the cancelled MO. opw:650395 --- addons/procurement_jit_stock/procurement_jit_stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/procurement_jit_stock/procurement_jit_stock.py b/addons/procurement_jit_stock/procurement_jit_stock.py index 5353b3edc0d..0b24a709558 100644 --- a/addons/procurement_jit_stock/procurement_jit_stock.py +++ b/addons/procurement_jit_stock/procurement_jit_stock.py @@ -29,7 +29,7 @@ class procurement_order(osv.osv): context = dict(context or {}, procurement_autorun_defer=True) res = super(procurement_order, self).run(cr, uid, ids, autocommit=autocommit, context=context) - procurement_ids = self.search(cr, uid, [('move_dest_id.procurement_id', 'in', ids)], order='id', context=context) + procurement_ids = self.search(cr, uid, [('move_dest_id.procurement_id', 'in', ids), ('state', 'not in', ['exception', 'cancel'])], order='id', context=context) if procurement_ids: return self.run(cr, uid, procurement_ids, autocommit=autocommit, context=context)