diff --git a/addons/stock/stock.py b/addons/stock/stock.py index dae2f0d82ce..5f3cc6596d1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -840,8 +840,12 @@ class stock_picking(osv.osv): # Used to search on pickings 'product_id': fields.related('move_lines', 'product_id', type='many2one', relation='product.product', string='Product'), 'recompute_pack_op': fields.boolean('Recompute pack operation?', help='True if reserved quants changed, which mean we might need to recompute the package operations', copy=False), - 'location_id': fields.related('move_lines', 'location_id', type='many2one', relation='stock.location', string='Location', readonly=True), - 'location_dest_id': fields.related('move_lines', 'location_dest_id', type='many2one', relation='stock.location', string='Destination Location', readonly=True), + 'location_id': fields.related('move_lines', 'location_id', type='many2one', relation='stock.location', string='Location', + readonly=True, store={'stock.picking': (lambda self, cr, uid, ids, ctx: ids, ['move_lines'], 10), + 'stock.move': (_get_pickings, ['location_id', 'picking_id'], 10),}), + 'location_dest_id': fields.related('move_lines', 'location_dest_id', type='many2one', relation='stock.location', string='Destination Location', + readonly=True, store={'stock.picking': (lambda self, cr, uid, ids, ctx: ids, ['move_lines'], 10), + 'stock.move': (_get_pickings, ['location_dest_id', 'picking_id'], 10),}), 'group_id': fields.related('move_lines', 'group_id', type='many2one', relation='procurement.group', string='Procurement Group', readonly=True, store={ 'stock.picking': (lambda self, cr, uid, ids, ctx: ids, ['move_lines'], 10),