From 3869cdf7d8202c8157c1134d74549b3096758253 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Wed, 18 Jul 2018 16:53:59 +0200 Subject: [PATCH] [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 --- addons/purchase/models/stock.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/purchase/models/stock.py b/addons/purchase/models/stock.py index 13517893217..8f6c1e58fcb 100644 --- a/addons/purchase/models/stock.py +++ b/addons/purchase/models/stock.py @@ -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