summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2017-11-09 11:23:33 +0100
committerSimon Lejeune <sle@openerp.com>2017-11-09 13:07:00 +0100
commita29ec8008201ed7ffaed32fd3960cd5ea76c5ff6 (patch)
tree525906f641e9c57f3af61e115176daf6aad98bbb
parent053209fb0eeb3f7b6de46ee8887fbf3e2df0b60e (diff)
[FIX] stock: _assign_picking
Commit[1] tried to improve the usability of the pick + pack + ship + a fixed procurement group scenario by erasing the origin value on the groupped ship that refered wrongly to only the first downstream document (and in fact refered to multiple). We forgot the scenario into which we add a sale order line. In this scenario, we also go through `_assign_picking` and, if an existing open picking is found, we also wiped its partner and origin value, which was indeed wrong. We fix this scenario by being more precise on the erasing condition. [1] 4a5f07654f6d4252f73253d26979cf97bbf7f11b
-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())