[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
This commit is contained in:
clesgow
2022-10-06 18:00:48 +02:00
parent cd2dbf0a67
commit 93ed42f12e
+3 -1
View File
@@ -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)