fix: added total column

This commit is contained in:
Afshan 2021-04-21 15:34:58 +05:30
parent 48b2fc9b12
commit 6d3305c446

View File

@ -120,6 +120,7 @@ def prepare_data(accounts, filters, parent_children_map, company_currency, dimen
for d in accounts:
has_value = False
total = 0
row = {
"account": d.name,
"parent_account": d.parent_account,
@ -137,8 +138,10 @@ def prepare_data(accounts, filters, parent_children_map, company_currency, dimen
if abs(row[frappe.scrub(item)]) >= 0.005:
# ignore zero values
has_value = True
total += flt(d.get(frappe.scrub(item), 0.0), 3)
row["has_value"] = has_value
row["total"] = total
data.append(row)
return data
@ -199,5 +202,12 @@ def get_columns(dimension_items_list, accumulated_values=1, company=None):
"options": "currency",
"width": 150
})
columns.append({
"fieldname": "total",
"label": "Total",
"fieldtype": "Currency",
"options": "currency",
"width": 150
})
return columns