[IMP] sale: remove fpos fallback in SOL compute

This commit is contained in:
Victor Feyens
2021-12-02 12:12:04 +01:00
committed by Yannick Tivisse
parent c574c76bc1
commit b8a0fe79f4
+2 -6
View File
@@ -139,19 +139,15 @@ class SaleOrderLine(models.Model):
@api.depends('product_id')
def _compute_tax_id(self):
cached_fpos = {}
for line in self:
line = line.with_company(line.company_id)
taxes = line.product_id.taxes_id.filtered(lambda t: t.company_id == line.env.company)
if not line.product_id or not taxes:
# Nothing to map
line.tax_id = [(5, 0, 0)]
line.tax_id = False
continue
if line.order_id not in cached_fpos:
cached_fpos[line.order_id] = line.order_id.fiscal_position_id or line.order_id.fiscal_position_id._get_fiscal_position(line.order_partner_id)
fpos = cached_fpos[line.order_id]
# If company_id is set, always filter taxes by the company
line.tax_id = fpos.map_tax(taxes)
line.tax_id = line.order_id.fiscal_position_id.map_tax(taxes)
@api.model_create_multi
def create(self, vals_list):