[IMP] Try to solve BoM expansion + check for context for splitting/copying moves
This commit is contained in:
parent
bdda11ab40
commit
a3390b0f96
|
@ -91,8 +91,9 @@ class StockMove(osv.osv):
|
|||
'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
|
||||
|
|
|
@ -48,7 +48,7 @@ class stock_move(osv.osv):
|
|||
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,
|
||||
|
|
|
@ -1752,13 +1752,17 @@ class stock_move(osv.osv):
|
|||
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'
|
||||
|
@ -2403,6 +2407,7 @@ class stock_move(osv.osv):
|
|||
'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'):
|
||||
|
|
Loading…
Reference in New Issue