[IMP] stock: run all procurements together on moves confirmation

On moves confirmation, multiple procurements can be created
and ran.

For performance concerns, we now run all procurements together.

opw-643560
This commit is contained in:
Denis Ledoux 2015-06-30 17:21:55 +02:00
parent 7d01029320
commit ddfc07a6a2
1 changed files with 3 additions and 2 deletions

View File

@ -2195,12 +2195,13 @@ class stock_move(osv.osv):
if key not in to_assign:
to_assign[key] = []
to_assign[key].append(move.id)
proc_ids = []
for move in self.browse(cr, uid, states['confirmed'], context=context):
if move.procure_method == 'make_to_order':
self._create_procurement(cr, uid, move, context=context)
proc_ids.append(self._create_procurement(cr, uid, move, context=dict(context, procurement_autorun_defer=True)))
states['waiting'].append(move.id)
states['confirmed'].remove(move.id)
self.pool['procurement.order'].run(cr, uid, proc_ids, context=context)
for state, write_ids in states.items():
if len(write_ids):