factor = move.product_qty
bom_point = bom_obj.browse(cr, uid, bis[0], context=context)
res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
- state = 'confirmed'
- if move.state == 'assigned':
- state = 'assigned'
for line in res[0]:
valdef = {
'picking_id': move.picking_id.id,
'product_uos': line['product_uos'],
'product_uos_qty': line['product_uos_qty'],
'move_dest_id': move.id,
- 'state': state,
+ 'state': 'draft', #will be confirmed below
'name': line['name'],
'move_history_ids': [(6,0,[move.id])],
'move_history_ids2': [(6,0,[])],
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
wf_service.trg_validate(uid, 'procurement.order', m, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
+ if processed_ids and move.state == 'assigned':
+ # Set the state of resulting moves according to 'assigned' as the original move is assigned
+ move_obj.write(cr, uid, list(set(processed_ids) - set([move.id])), {'state': 'assigned'}, context=context)
return processed_ids
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):