From 097963624f565d480f70aa9615fbff6a25745f28 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 10 Sep 2018 14:26:09 +0200 Subject: [PATCH] [FIX] stock: prevent location change Changing the partner on a picking triggers an onchange which might modify `location_id` or `location_dest_id`. However, when the picking is not draft anymore, these fields are not supposed to be changed. opw-1872635 --- addons/stock/models/stock_picking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 1638d1d4356..47828768f1e 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -470,8 +470,9 @@ class Picking(models.Model): else: location_dest_id, supplierloc = self.env['stock.warehouse']._get_partner_locations() - self.location_id = location_id - self.location_dest_id = location_dest_id + if self.state == 'draft': + self.location_id = location_id + self.location_dest_id = location_dest_id # TDE CLEANME move into onchange_partner_id if self.partner_id: if self.partner_id.picking_warn == 'no-message' and self.partner_id.parent_id: