diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 73708e13e51..8fb42672d1e 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1505,6 +1505,11 @@ class SaleOrderLine(models.Model): price_subtotal = line.price_reduce * line.qty_delivered else: price_subtotal = line.price_reduce * line.product_uom_qty + if len(line.tax_id.filtered(lambda tax: tax.price_include)) > 0: + # As included taxes are not excluded from the computed subtotal, `compute_all()` method + # has to be called to retrieve the subtotal without them. + # `price_reduce_taxexcl` cannot be used as it is computed from `price_subtotal` field. (see upper Note) + price_subtotal = line.tax_id.compute_all(price_subtotal)['total_excluded'] amount_to_invoice = price_subtotal - line.untaxed_amount_invoiced line.untaxed_amount_to_invoice = amount_to_invoice