From 1750b90252e040cb6f84e7aadc4292ff7eee5182 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Fri, 17 Jun 2016 10:27:53 +0200 Subject: [PATCH] [FIX] account: fixed group_lines method of invoices. The group_lines method didn't make the sum of the quantity field, hence resulting in incorrect results when making product based statistics from the account.move.line records. Courtesy of Luc De Meyer. Was PR #10551 --- addons/account/account_invoice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index aefa91aa3da..6625cc5493a 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -781,6 +781,9 @@ class account_invoice(models.Model): line2[tmp]['tax_amount'] += l['tax_amount'] line2[tmp]['amount_currency'] += l['amount_currency'] line2[tmp]['analytic_lines'] += l['analytic_lines'] + qty = l.get('quantity') + if qty: + line2[tmp]['quantity'] = line2[tmp].get('quantity', 0.0) + qty else: line2[tmp] = l line = []