Преглед на файлове

Currency of total row in reports

version-14
Nabin Hait преди 9 години
родител
ревизия
c1bab9d5d0
променени са 1 файла, в които са добавени 17 реда и са изтрити 12 реда
  1. +17
    -12
      frappe/desk/query_report.py

+ 17
- 12
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)


Зареждане…
Отказ
Запис