[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] 4a5f07654f
This commit is contained in:
Simon Lejeune
2017-11-09 13:07:00 +01:00
parent 053209fb0e
commit a29ec80082
+8 -7
View File
@@ -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())