[IMP] To optimize procurement_jit, we let it depend on stock. Runs can be done in batch that way. Optimizations from work of api

[IMP] Simplify to single search

[IMP] Make sure procurements are run in the original order
This commit is contained in:
Josse Colpaert
2015-03-03 15:21:41 +01:00
parent 03131edace
commit c5dc1288c2
3 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ In that case, you can not use priorities any more on the different picking.
""",
'author': 'OpenERP SA',
'website': 'https://www.odoo.com/page/manufacturing',
'depends': ['procurement'],
'depends': ['procurement', 'stock'],
'data': [],
'demo': [],
'test': ['test/procurement_jit.yml'],
+11
View File
@@ -32,3 +32,14 @@ class procurement_order(osv.osv):
self.run(cr, uid, [procurement_id], context=context)
self.check(cr, uid, [procurement_id], context=context)
return procurement_id
def run(self, cr, uid, ids, context=None):
context = context or {}
context['procurement_autorun_defer'] = True
res = super(procurement_order, self).run(cr, uid, ids, context=context)
procurement_ids = self.search(cr, uid, [('move_dest_id.procurement_id', 'in', ids)], order='id', context=context)
if procurement_ids:
return self.run(cr, uid, procurement_ids, context=context)
return res
+1 -1
View File
@@ -1950,7 +1950,7 @@ class stock_move(osv.osv):
def _create_procurement(self, cr, uid, move, context=None):
""" This will create a procurement order """
return self.pool.get("procurement.order").create(cr, uid, self._prepare_procurement_from_move(cr, uid, move, context=context))
return self.pool.get("procurement.order").create(cr, uid, self._prepare_procurement_from_move(cr, uid, move, context=context), context=context)
def write(self, cr, uid, ids, vals, context=None):
if context is None: