From e08f947abe5dc53768eb20463133c5fef177d816 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 14 Aug 2018 11:16:50 +0200 Subject: [PATCH] [FIX] purchase: use field in purchase_stock The field move_dest_ids is now defined in purchase_stock (since the split at rev 8d4609a1db) The line was added in purchase at f6b3247c31 in 11.0 but incorrectly forward ported. This commit only moves the code to the appropriate module. --- addons/purchase/models/purchase.py | 1 - addons/purchase_stock/models/purchase.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 71fb9815bc0..111bda3cce7 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -324,7 +324,6 @@ class PurchaseOrder(models.Model): for inv in order.invoice_ids: if inv and inv.state not in ('cancel', 'draft'): raise UserError(_("Unable to cancel this purchase order. You must first cancel the related vendor bills.")) - order.order_line.write({'move_dest_ids':[(5,0,0)]}) self.write({'state': 'cancel'}) diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index fadfa47d1d1..19a6a321d6a 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -105,6 +105,9 @@ 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)]}) + return super(PurchaseOrder, self).button_cancel() @api.multi