Merge pull request #38583 from AarDG10/fix-report-export
fix(reportview): support dict. when parsing fields
This commit is contained in:
commit
c61766cd47
1 changed files with 9 additions and 3 deletions
|
|
@ -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(")):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue