[IMP] Fasten up procurement JIT in v8 already
This commit is contained in:
parent
85ede15793
commit
50fc06e275
|
@ -26,9 +26,11 @@ class procurement_order(osv.osv):
|
|||
_inherit = "procurement.order"
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
context = context or {}
|
||||
procurement_id = super(procurement_order, self).create(cr, uid, vals, context=context)
|
||||
self.run(cr, uid, [procurement_id], context=context)
|
||||
self.check(cr, uid, [procurement_id], context=context)
|
||||
if not context.get('procurement_autorun_defer'):
|
||||
self.run(cr, uid, [procurement_id], context=context)
|
||||
self.check(cr, uid, [procurement_id], context=context)
|
||||
return procurement_id
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -695,7 +695,7 @@ class sale_order(osv.osv):
|
|||
|
||||
:return: True
|
||||
"""
|
||||
context = dict(context)
|
||||
context = context or {}
|
||||
context['lang'] = self.pool['res.users'].browse(cr, uid, uid).lang
|
||||
procurement_obj = self.pool.get('procurement.order')
|
||||
sale_line_obj = self.pool.get('sale.order.line')
|
||||
|
@ -719,7 +719,9 @@ class sale_order(osv.osv):
|
|||
if (line.state == 'done') or not line.product_id:
|
||||
continue
|
||||
vals = self._prepare_order_line_procurement(cr, uid, order, line, group_id=order.procurement_group_id.id, context=context)
|
||||
proc_id = procurement_obj.create(cr, uid, vals, context=context)
|
||||
ctx = context.copy()
|
||||
ctx['procurement_autorun_defer'] = True
|
||||
proc_id = procurement_obj.create(cr, uid, vals, context=ctx)
|
||||
proc_ids.append(proc_id)
|
||||
#Confirm procurement order such that rules will be applied on it
|
||||
#note that the workflow normally ensure proc_ids isn't an empty list
|
||||
|
|
Loading…
Reference in New Issue