Skip to content
Permalink
Browse files

Correctly filter product taxes in multicompany case

  • Loading branch information...
gdgellatly committed Mar 22, 2019
1 parent e9026bd commit 15e7b7b018c67a22bb8a71c35f7826f956c3f6ec
Showing with 5 additions and 6 deletions.
  1. +5 −6 addons/account/models/account_invoice.py
@@ -1708,14 +1708,13 @@ def _set_currency(self):
def _set_taxes(self):
""" Used in on_change to set taxes and price"""
self.ensure_one()
if self.invoice_id.type in ('out_invoice', 'out_refund'):
taxes = self.product_id.taxes_id or self.account_id.tax_ids or self.invoice_id.company_id.account_sale_tax_id
else:
taxes = self.product_id.supplier_taxes_id or self.account_id.tax_ids or self.invoice_id.company_id.account_purchase_tax_id

# Keep only taxes of the company
company_id = self.company_id or self.env.user.company_id
taxes = taxes.filtered(lambda r: r.company_id == company_id)

if self.invoice_id.type in ('out_invoice', 'out_refund'):
taxes = self.product_id.taxes_id.filtered(lambda r: r.company_id == company_id) or self.account_id.tax_ids or self.invoice_id.company_id.account_sale_tax_id
else:
taxes = self.product_id.supplier_taxes_id.filtered(lambda r: r.company_id == company_id) or self.account_id.tax_ids or self.invoice_id.company_id.account_purchase_tax_id

self.invoice_line_tax_ids = fp_taxes = self.invoice_id.fiscal_position_id.map_tax(taxes, self.product_id, self.invoice_id.partner_id)

0 comments on commit 15e7b7b

Please sign in to comment.
You can’t perform that action at this time.