[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:
@@ -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'],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user