summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/stock/models/stock_move.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index b51495cb3d7..5ec43a2728b 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -652,13 +652,14 @@ class StockMove(models.Model):
('printed', '=', False),
('state', 'in', ['draft', 'confirmed', 'waiting', 'partially_available', 'assigned'])], limit=1)
if picking:
- # If a picking is found, we'll append `move` to its move list and thus its
- # `partner_id` and `ref` field will refer to multiple records. In this
- # case, we chose to wipe them.
- picking.write({
- 'partner_id': False,
- 'origin': False,
- })
+ if picking.partner_id.id != move.partner_id.id or picking.origin != move.origin:
+ # If a picking is found, we'll append `move` to its move list and thus its
+ # `partner_id` and `ref` field will refer to multiple records. In this
+ # case, we chose to wipe them.
+ picking.write({
+ 'partner_id': False,
+ 'origin': False,
+ })
else:
recompute = True
picking = Picking.create(move._get_new_picking_values())