Merge pull request #38583 from AarDG10/fix-report-export

fix(reportview): support dict. when parsing fields
This commit is contained in:
Aarol D'Souza 2026-04-14 16:25:23 +05:30 committed by GitHub
commit c61766cd47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -520,8 +520,11 @@ def get_field_info(fields, doctype):
except ValueError:
# handles aggregate functions
parenttype = doctype
fieldname = key.split("(", 1)[0]
fieldname = fieldname[0].upper() + fieldname[1:]
if isinstance(key, dict):
fieldname = next(k for k in key if k != "as")
else:
fieldname = key.split("(", 1)[0]
fieldname = fieldname.capitalize()
parenttype = parenttype or doctype
@ -580,8 +583,11 @@ def handle_duration_fieldtype_values(doctype, data, fields):
return data
def parse_field(field: str) -> tuple[str | None, str]:
def parse_field(field: str | dict) -> tuple[str | None, str]:
"""Parse a field into parenttype and fieldname."""
if isinstance(field, dict): # for aggregates via qb
raise ValueError
key = field.split(" as ", 1)[0]
if key.startswith(("count(", "sum(", "avg(")):