From f6b3247c31ee176944a060afb911021d071d8a32 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 25 Jun 2018 13:57:15 +0200 Subject: [PATCH] [FIX] purchase: remove move_dest_ids when PO line cancelled When a PO is confirmed, cancelled, set back to draft and confirmed again, the push rules don't apply because the PO lines have move_dest_ids. So we remove those move_dest_ids from PO lines, to allow push rules to be applied on the newly confirmed PO. OPW-1859363 --- addons/purchase/models/purchase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index f27545a15ed..523b11d75f7 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -378,6 +378,8 @@ class PurchaseOrder(models.Model): for pick in order.picking_ids.filtered(lambda r: r.state != 'cancel'): pick.action_cancel() + order.order_line.write({'move_dest_ids':[(5,0,0)]}) + self.write({'state': 'cancel'}) @api.multi