summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2018-08-14 11:16:50 +0200
committerMartin Trigaux <mat@odoo.com>2018-08-14 11:16:50 +0200
commite08f947abe5dc53768eb20463133c5fef177d816 (patch)
tree93e198844323119a6f7e45cd78ef2fc090666ed0
parentdaec62ab6844338e656e2d67224e5774f246eb77 (diff)
[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.
-rw-r--r--addons/purchase/models/purchase.py1
-rw-r--r--addons/purchase_stock/models/purchase.py3
2 files changed, 3 insertions, 1 deletions
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