[FIX] account: filter taxes
In a multi-company environment, a user from company A which is a parent of the company B has access to taxes from both companies. The consequence is that the method _set_taxes will automatically add the taxes from both companies.
This commit is contained in:
@@ -5,7 +5,7 @@ from lxml import etree
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from openerp import api, fields, models, _, SUPERUSER_ID
|
||||
from openerp import api, fields, models, _
|
||||
from openerp.tools import float_is_zero, float_compare
|
||||
from openerp.tools.misc import formatLang
|
||||
|
||||
@@ -1093,8 +1093,11 @@ class AccountInvoiceLine(models.Model):
|
||||
taxes = self.product_id.taxes_id or self.account_id.tax_ids
|
||||
else:
|
||||
taxes = self.product_id.supplier_taxes_id or self.account_id.tax_ids
|
||||
if self.env.uid == SUPERUSER_ID:
|
||||
taxes = taxes.filtered(lambda r: r.company_id == self.company_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)
|
||||
|
||||
self.invoice_line_tax_ids = fp_taxes = self.invoice_id.fiscal_position_id.map_tax(taxes)
|
||||
|
||||
fix_price = self.env['account.tax']._fix_tax_included_price
|
||||
|
||||
Reference in New Issue
Block a user