From 1085afd6378de5ded2ff01735d86e22f7a163526 Mon Sep 17 00:00:00 2001 From: clesgow Date: Fri, 27 Oct 2023 10:45:11 +0200 Subject: [PATCH] [FIX] stock: compute locations for picking partners Steps to reproduce: - Enable multi-step reception - Create a reception in WH/Input - Open an internal picking further down the chain - Change its contact Issue: The location_id and location_dest_id is getting reset to Operation type's default locations, which will raise a warning because the location/dest don't match the ones from the moves anymore. It was decided to only allow the automatic compute of locations for draft pickings. Which means : - Compute will trigger normally when manually creating a picking - Picking type is readonly outside of draft anyway, so don't change anything for this change - Changing locations of a non-draft picking is a risky operation, as they won't match the moves. So better leave it as a manual change. closes odoo/odoo#140055 Signed-off-by: William Henrotin (whe) --- addons/stock/models/stock_picking.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 585e9a0c798..5a8047bb8e5 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -743,6 +743,8 @@ class Picking(models.Model): @api.depends('picking_type_id', 'partner_id') def _compute_location_id(self): for picking in self: + if picking.state != 'draft': + continue picking = picking.with_company(picking.company_id) if picking.picking_type_id: if picking.picking_type_id.default_location_src_id: