From 93ed42f12ef2aec6f259f7ecb10746c83ded64d4 Mon Sep 17 00:00:00 2001 From: clesgow Date: Thu, 8 Sep 2022 10:07:44 +0000 Subject: [PATCH] [FIX] purchase_stock: confirm push pickings When creating a Purchase Order with multi-step reception, the pickings created by the push rules won't get confirmed as they should be (like in the sales multi-step flow). This creates issues further down with auto-batch as created pickings don't get auto-batched even if the picking type is set to do it. Task-2971346 X-original-commit: dc517bbe7ffbae8a8774f705c9431dce45c461ba Part-of: odoo/odoo#102382 --- addons/purchase_stock/models/purchase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index a3a1dce3b40..cb32d841d68 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -245,7 +245,9 @@ class PurchaseOrder(models.Model): seq += 5 move.sequence = seq moves._action_assign() - pickings.action_confirm() + # Get following pickings (created by push rules) to confirm them as well. + forward_pickings = self.env['stock.picking']._get_impacted_pickings(moves) + (pickings | forward_pickings).action_confirm() picking.message_post_with_view('mail.message_origin_link', values={'self': picking, 'origin': order}, subtype_id=self.env.ref('mail.mt_note').id)