From 65bf6988f941be6fe1e88202bc814e4b645abf79 Mon Sep 17 00:00:00 2001 From: Florian Gilbert Date: Fri, 7 Aug 2020 05:35:00 +0000 Subject: [PATCH] [FIX & IMP] purchase: Remove weird domain in attrs & add purchase order on account move line. This commit removes "state = purchase" in account move attrs domain. The purchase state doesn't exist. This commit adds a related field to purchase order in account move line. Task ID: 2312024 closes odoo/odoo#55611 Signed-off-by: oco-odoo --- addons/purchase/models/account_invoice.py | 1 + addons/purchase/views/account_move_views.xml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py index f5756dcf1f2..103cb20a888 100644 --- a/addons/purchase/models/account_invoice.py +++ b/addons/purchase/models/account_invoice.py @@ -131,6 +131,7 @@ class AccountMoveLine(models.Model): _inherit = 'account.move.line' purchase_line_id = fields.Many2one('purchase.order.line', 'Purchase Order Line', ondelete='set null', index=True) + purchase_order_id = fields.Many2one('purchase.order', 'Purchase Order', related='purchase_line_id.order_id', readonly=True) def _copy_data_extend_business_fields(self, values): # OVERRIDE to copy the 'purchase_line_id' field as well. diff --git a/addons/purchase/views/account_move_views.xml b/addons/purchase/views/account_move_views.xml index 60b3fae272a..565cab9d442 100644 --- a/addons/purchase/views/account_move_views.xml +++ b/addons/purchase/views/account_move_views.xml @@ -10,9 +10,9 @@