'product_uos_qty': line['product_uos_qty'],
'state': state,
'name': line['name'],
+ 'procurement_id': move.procurement_id.id,
}
- mid = move_obj.copy(cr, uid, move.id, default=valdef)
+ mid = move_obj.copy(cr, uid, move.id, default=valdef, context={'split': True})
to_explode_again_ids.append(mid)
#delete the move with original product which is not relevant anymore
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not default.get('split_from'):
+ if not default.get('split_from') and not context.get('split'):
#we don't want to propagate the link to the purchase order line except in case of move split
default.update({
'purchase_line_id': False,
if default is None:
default = {}
default = default.copy()
- default['move_orig_ids'] = []
default['quant_ids'] = []
- default['move_dest_id'] = False
default['reserved_quant_ids'] = []
default['returned_move_ids'] = []
default['linked_move_operation_ids'] = []
default['partially_available'] = False
+ if not default.get('move_orig_ids'):
+ default['move_orig_ids'] = []
+ if not default.get('move_dest_id'):
+ default['move_dest_id'] = False
+ if not default.get('procurement_id'):
+ default['procurement_id'] = False
if not default.get('origin_returned_move_id'):
default['origin_returned_move_id'] = False
default['state'] = 'draft'
'restrict_lot_id': restrict_lot_id,
'restrict_partner_id': restrict_partner_id,
'split_from': move.id,
+ 'procurement_id': move.procurement_id.id,
'move_dest_id': move.move_dest_id.id,
}
if context.get('source_location_id'):