diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 38f262db761..eb135fecc20 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1562,10 +1562,8 @@ class SaleOrderLine(models.Model): # amount and not zero. Since we compute untaxed amount, we can use directly the price # reduce (to include discount) without using `compute_all()` method on taxes. price_subtotal = 0.0 - if line.product_id.invoice_policy == 'delivery': - price_subtotal = line.price_reduce * line.qty_delivered - else: - price_subtotal = line.price_reduce * line.product_uom_qty + umo_qty_to_consider = line.qty_delivered if line.product_id.invoice_policy == 'delivery' else line.product_uom_qty + price_subtotal = line.price_reduce * umo_qty_to_consider 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. @@ -1573,7 +1571,7 @@ class SaleOrderLine(models.Model): price_subtotal = line.tax_id.compute_all( line.price_reduce, currency=line.order_id.currency_id, - quantity=line.product_uom_qty, + quantity=umo_qty_to_consider, product=line.product_id, partner=line.order_id.partner_shipping_id)['total_excluded']