[FIX] sale: Wrong untaxed_amount_to_invoice
Steps to reproduce the bug: - Let's consider an included tax T (10%) and a product P (11€) with invoicing policy based on delivery - Create a sale order SO with one line L with 2 P and T - Confirm SO Bug: The untaxed_amount_to_invoice was 20€ on L instead 0€ The untaxed_amount_to_invoice must be 20€ when the delivery is processed opw:2457660 opw:2457660 closes odoo/odoo#67682 X-original-commit: d6ed6b9fa204fcfcabf1c1c330b5ae8ada34744c Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -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']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user