Browse Source

Merge branch 'hotfix'

version-14
Nabin Hait 9 years ago
parent
commit
f284668af5
2 changed files with 18 additions and 13 deletions
  1. +1
    -1
      frappe/__init__.py
  2. +17
    -12
      frappe/desk/query_report.py

+ 1
- 1
frappe/__init__.py View File

@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from .exceptions import * from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template from .utils.jinja import get_jenv, get_template, render_template


__version__ = "7.0.24"
__version__ = "7.0.25"


local = Local() local = Local()




+ 17
- 12
frappe/desk/query_report.py View File

@@ -113,22 +113,27 @@ def get_report_module_dotted_path(module, report_name):
def add_total_row(result, columns): def add_total_row(result, columns):
total_row = [""]*len(columns) total_row = [""]*len(columns)
has_percent = [] 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]): if fieldtype in ["Currency", "Int", "Float", "Percent"] and flt(row[i]):
total_row[i] = flt(total_row[i]) + flt(row[i]) total_row[i] = flt(total_row[i]) + flt(row[i])
if fieldtype == "Percent" and i not in has_percent: if fieldtype == "Percent" and i not in has_percent:
has_percent.append(i) has_percent.append(i)
if fieldtype=="Link" and options == "Currency":
total_row[i] = result[0][i]


for i in has_percent: for i in has_percent:
total_row[i] = total_row[i] / len(result) total_row[i] = total_row[i] / len(result)


Loading…
Cancel
Save