From 85e8d13768399ceb1a1912fed39aa8ddca76676e Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 22 Jun 2018 09:11:06 +0200 Subject: [PATCH] [FIX] sale: Amount Invoiced in Sales Analysis --- addons/sale/models/sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 2fab6a07778..ce19c933f9c 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -735,7 +735,8 @@ class SaleOrderLine(models.Model): # Total invoiced amount invoiced_amount_total = sum(invoice_lines.mapped('price_total')) # Total refunded amount - refund_amount_total = sum(refund_invoices.mapped('amount_total')) + refund_invoice_lines = refund_invoices.mapped('invoice_line_ids').filtered(lambda l: l.product_id == line.product_id) + refund_amount_total = sum(refund_invoice_lines.mapped('price_total')) # Total of remaining amount to invoice on the sale ordered (and draft invoice included) to support upsell (when # delivered quantity is higher than ordered one). Draft invoice are ignored on purpose, the 'to invoice' should # come only from the SO lines.