[FIX] purchase: Restore push rules behavior in 2 steps reception

Due to this commit: https://github.com/odoo/odoo/commit/ab5fcb29650349fa641c6130bf6dcbdc1ec28a07
When confirming a PO with two lines having the same product,
the stock moves were not merged anymore in the putaway
(input to stock) picking.

Reason:
When confirming the PO, odoo creates first a receipt
(vendor to input) picking and its stock moves matching the PO line.
Then it applies the push rule on each move. Both putaway
(input to stock) moves are created by copying the receipt
(vendor to input) moves, but when the second is created,
odoo check if there's another move to merge sharing same
properties to merge into it. As purchase_line_id is now copied
in both cases, both putaway moves include a different
purchase_line_id and won't be merged together, since this field
is in _prepare_merge_moves_distinct_fields() on stock.move.

opw:1854387
This commit is contained in:
Akim Juillerat
2018-07-19 15:03:11 +02:00
committed by Goffin Simon
parent 22062d9efc
commit 3869cdf7d8
+9
View File
@@ -184,3 +184,12 @@ class Orderpoint(models.Model):
result['domain'] = "[('id','in',%s)]" % (purchase_ids.ids)
return result
class PushedFlow(models.Model):
_inherit = "stock.location.path"
def _prepare_move_copy_values(self, move_to_copy, new_date):
res = super()._prepare_move_copy_values(move_to_copy, new_date)
res['purchase_line_id'] = None
return res