diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 4176d75229a332b1e4891ac346801a48d2c57fc0..ad6ef43a0364a248bdc7d5b45583e50e58df9f39 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -545,17 +545,9 @@ class SaleOrderLine(models.Model): def _compute_tax_id(self): for line in self: fpos = line.order_id.fiscal_position_id or line.order_id.partner_id.property_account_position_id - if fpos: - # The superuser is used by website_sale in order to create a sale order. We need to make - # sure we only select the taxes related to the company of the partner. This should only - # apply if the partner is linked to a company. - if self.env.uid == SUPERUSER_ID and line.order_id.company_id: - taxes = fpos.map_tax(line.product_id.taxes_id).filtered(lambda r: r.company_id == line.order_id.company_id) - else: - taxes = fpos.map_tax(line.product_id.taxes_id) - line.tax_id = taxes - else: - line.tax_id = line.product_id.taxes_id if line.product_id.taxes_id else False + # If company_id is set, always filter taxes by the company + taxes = line.product_id.taxes_id.filtered(lambda r: not line.company_id or r.company_id == line.company_id) + line.tax_id = fpos.map_tax(taxes) if fpos else taxes @api.multi def _prepare_order_line_procurement(self, group_id=False):