[FIX] stock: quant_ids relations should not be copied when copying moves fixes #5848
The same holds for the inverse history_ids relationship. When an object is copied, the many2many fields their links are copied. When we copy a done move as is done in the return wizard to create the reverse, it copied also the relationship with the quants. This is problematic as this field indicates the quants that were transferred by the move and the new move will think it will have returned all the quants even before it is done.
This commit is contained in:
parent
77a75d4e1f
commit
23873da6b6
|
@ -305,7 +305,7 @@ class stock_quant(osv.osv):
|
|||
'create_date': fields.datetime('Creation Date', readonly=True),
|
||||
'in_date': fields.datetime('Incoming Date', readonly=True, select=True),
|
||||
|
||||
'history_ids': fields.many2many('stock.move', 'stock_quant_move_rel', 'quant_id', 'move_id', 'Moves', help='Moves that operate(d) on this quant'),
|
||||
'history_ids': fields.many2many('stock.move', 'stock_quant_move_rel', 'quant_id', 'move_id', 'Moves', help='Moves that operate(d) on this quant', copy=False),
|
||||
'company_id': fields.many2one('res.company', 'Company', help="The company to which the quants belong", required=True, readonly=True, select=True),
|
||||
'inventory_value': fields.function(_calc_inventory_value, string="Inventory Value", type='float', readonly=True),
|
||||
|
||||
|
@ -1777,7 +1777,7 @@ class stock_move(osv.osv):
|
|||
# used for colors in tree views:
|
||||
'scrapped': fields.related('location_dest_id', 'scrap_location', type='boolean', relation='stock.location', string='Scrapped', readonly=True),
|
||||
|
||||
'quant_ids': fields.many2many('stock.quant', 'stock_quant_move_rel', 'move_id', 'quant_id', 'Moved Quants'),
|
||||
'quant_ids': fields.many2many('stock.quant', 'stock_quant_move_rel', 'move_id', 'quant_id', 'Moved Quants', copy=False),
|
||||
'reserved_quant_ids': fields.one2many('stock.quant', 'reservation_id', 'Reserved quants'),
|
||||
'linked_move_operation_ids': fields.one2many('stock.move.operation.link', 'move_id', string='Linked Operations', readonly=True, help='Operations that impact this move for the computation of the remaining quantities'),
|
||||
'remaining_qty': fields.function(_get_remaining_qty, type='float', string='Remaining Quantity', digits=0,
|
||||
|
|
Loading…
Reference in New Issue