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 @@