diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index ef74b8315b0..5d0dd9d83cd 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -502,19 +502,14 @@ class SaleOrder(models.Model): res = {} currency = self.currency_id or self.company_id.currency_id for line in self.order_line: - base_tax = 0 + price_reduce = line.price_unit * (1.0 - line.discount / 100.0) + taxes = line.tax_id.compute_all(price_reduce, quantity=line.product_uom_qty, product=line.product_id, partner=self.partner_shipping_id)['taxes'] for tax in line.tax_id: group = tax.tax_group_id res.setdefault(group, 0.0) - # FORWARD-PORT UP TO SAAS-17 - price_reduce = line.price_unit * (1.0 - line.discount / 100.0) - taxes = tax.compute_all(price_reduce + base_tax, quantity=line.product_uom_qty, - product=line.product_id, partner=self.partner_shipping_id)['taxes'] for t in taxes: - res[group] += t['amount'] - if tax.include_base_amount: - base_tax += tax.compute_all(price_reduce + base_tax, quantity=1, product=line.product_id, - partner=self.partner_shipping_id)['taxes'][0]['amount'] + if t['id'] == tax.id or t['id'] in tax.children_tax_ids.ids: + res[group] += t['amount'] res = sorted(res.items(), key=lambda l: l[0].sequence) res = map(lambda l: (l[0].name, l[1]), res) return res