From ab7b3dd40d6bb483eedc98a28860834876a99516 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 23 Mar 2020 13:27:22 +0000 Subject: [PATCH] [FIX] sale: fix amount in Sales Report Simply create an SO with more than 1 Qty and deliver. An untaxed amount is shown on the SO. Check in Sales > Reporting > Sales > Pivot view, the Untaxed amount Invoiced and Untaxed amount to invoice Measures. They show the right amount. Make a partial return from the original SO and validate. Reduce the quantity on the sale order line. The sales report is not updated with the right untaxed amount to invoice. This occur because when the sale order line have an increased qty_ordered a chain of event is triggered which included the recomputation of the untaxed_amount_to_invoice which does not occur on decrese. Adding the product_uom_qty to recompute triggers fix the issue opw-2213996 closes odoo/odoo#48282 X-original-commit: f8a5366ea650c1a2ac4ad3a42da7da4a34758d60 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 7d877ab8279..e486183cb69 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1454,7 +1454,7 @@ class SaleOrderLine(models.Model): amount_invoiced -= invoice_line.currency_id._convert(invoice_line.price_subtotal, line.currency_id, line.company_id, invoice_date) line.untaxed_amount_invoiced = amount_invoiced - @api.depends('state', 'price_reduce', 'product_id', 'untaxed_amount_invoiced', 'qty_delivered') + @api.depends('state', 'price_reduce', 'product_id', 'untaxed_amount_invoiced', 'qty_delivered', 'product_uom_qty') def _compute_untaxed_amount_to_invoice(self): """ Total of remaining amount to invoice on the sale order line (taxes excl.) as total_sol - amount already invoiced