From dea09e538478c915b330758af3cdc45b9fb8ac93 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Thu, 10 Oct 2024 17:13:02 +0530 Subject: [PATCH] chore(add_total_row): guess fieldtype from cell data type if not defined Signed-off-by: Akhil Narang --- frappe/desk/query_report.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index adfc4e4692..40f049d2ad 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -475,6 +475,11 @@ def add_total_row(result, columns, meta=None, is_tree=False, parent_field=None): if i >= len(row): continue cell = row.get(fieldname) if isinstance(row, dict) else row[i] + if fieldtype is None: + if isinstance(cell, int): + fieldtype = "Int" + elif isinstance(cell, float): + fieldtype = "Float" if fieldtype in ["Currency", "Int", "Float", "Percent", "Duration"] and flt(cell): if not (is_tree and row.get(parent_field)): total_row[i] = flt(total_row[i]) + flt(cell)