diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-06-30 17:21:55 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-06-30 17:24:24 +0200 |
| commit | ddfc07a6a2e8c399639c6cb8fde2a579b33cd6b0 (patch) | |
| tree | d3aae0b827b6e1299e9dafdbc38fe0d6ad7ff541 | |
| parent | 7d01029320ce1c90094253dad7bb576539050ad7 (diff) | |
[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
| -rw-r--r-- | addons/stock/stock.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 83a94d17f78..bf452a012c2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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): |
