From c80f7589895fd2b53c4d32e73bc432648e46490c Mon Sep 17 00:00:00 2001 From: "Sunil Sharma (OpenERP Trainee)" Date: Thu, 8 Aug 2013 11:23:54 +0530 Subject: [PATCH] [IMP]:Account:account_invoice_report.py bzr revid: sunilsharma.sharma07@gmail.com-20130808055354-0379xbn60gbcmvsc --- addons/account/report/account_invoice_report.py | 15 ++++++++++++++- .../report/account_invoice_report_view.xml | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index d8dc45f9a3b..8674e71e109 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -29,7 +29,7 @@ class account_invoice_report(osv.osv): _auto = False _rec_name = 'date' - def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names, args, context=None): + def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names=[], args={}, context=None): """Compute the amounts in the currency of the user """ if context is None: @@ -103,6 +103,19 @@ class account_invoice_report(osv.osv): } _order = 'date desc' + #FIX:To show sum of values of function fields in groupby + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): + res = super(account_invoice_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) + for group in res: + group['user_currency_price_total'] = 0 + group_ids = self.search(cr, uid, group.get('__domain'),context=context) + record = self._compute_amounts_in_user_currency(cr, uid, group_ids, context=context) + for id, rec in record.iteritems(): + group['user_currency_price_total'] += rec['user_currency_price_total'] + + return res + + def _select(self): select_str = """ SELECT sub.id, sub.date, sub.year, sub.month, sub.day, sub.product_id, sub.partner_id, sub.country_id, diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 5f38db5e71f..4c297fd52e8 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -30,7 +30,7 @@ - + @@ -41,7 +41,7 @@ - +