diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index ac367bffa41..b8c0e80a31d 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -125,6 +125,8 @@ class PurchaseOrder(models.Model): tax_country_id = fields.Many2one( comodel_name='res.country', compute='_compute_tax_country_id', + # Avoid access error on fiscal position, when reading a purchase order with company != user.company_ids + compute_sudo=True, help="Technical field to filter the available taxes depending on the fiscal country and fiscal position.") payment_term_id = fields.Many2one('account.payment.term', 'Payment Terms', domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]") incoterm_id = fields.Many2one('account.incoterms', 'Incoterm', states={'done': [('readonly', True)]}, help="International Commercial Terms are a series of predefined commercial terms used in international transactions.") diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py index 7d1e4dfe5cf..f668729c711 100644 --- a/addons/sale/models/sale_order.py +++ b/addons/sale/models/sale_order.py @@ -238,6 +238,8 @@ class SaleOrder(models.Model): tax_country_id = fields.Many2one( comodel_name='res.country', compute='_compute_tax_country_id', + # Avoid access error on fiscal position when reading a sale order with company != user.company_ids + compute_sudo=True, help="Technical field to filter the available taxes depending on the fiscal country and fiscal position.") company_id = fields.Many2one('res.company', 'Company', required=True, index=True, default=lambda self: self.env.company) team_id = fields.Many2one(