From c1bab9d5d0e7ad38f0447ae212a7fe77bf71f506 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 Aug 2016 18:27:25 +0530 Subject: [PATCH 1/2] Currency of total row in reports --- frappe/desk/query_report.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index 09bebed2b3..31c376e914 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -113,22 +113,27 @@ def get_report_module_dotted_path(module, report_name): def add_total_row(result, columns): total_row = [""]*len(columns) has_percent = [] - for row in result: - for i, col in enumerate(columns): - fieldtype = None - if isinstance(col, basestring): - col = col.split(":") - if len(col) > 1: - fieldtype = col[1] - if "/" in fieldtype: - fieldtype = fieldtype.split("/")[0] - else: - fieldtype = col.get("fieldtype") - + for i, col in enumerate(columns): + fieldtype, options = None, None + if isinstance(col, basestring): + col = col.split(":") + if len(col) > 1: + fieldtype = col[1] + if "/" in fieldtype: + fieldtype, options = fieldtype.split("/") + else: + fieldtype = col.get("fieldtype") + options = col.get("options") + + for row in result: if fieldtype in ["Currency", "Int", "Float", "Percent"] and flt(row[i]): total_row[i] = flt(total_row[i]) + flt(row[i]) + if fieldtype == "Percent" and i not in has_percent: has_percent.append(i) + + if fieldtype=="Link" and options == "Currency": + total_row[i] = result[0][i] for i in has_percent: total_row[i] = total_row[i] / len(result) From 18e192d56108e29fafc6635a3b06cfdb2429b28d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2016 16:37:04 +0600 Subject: [PATCH 2/2] bumped to version 7.0.25 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 77a7eb3a76..06bc102ee4 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template -__version__ = "7.0.24" +__version__ = "7.0.25" local = Local()