Merge pull request #31920 from sokumon/filters-in-report-name

fix: hard checks on report name length
This commit is contained in:
Soham Kulkarni 2025-04-01 13:35:04 +05:30 committed by GitHub
commit 9a1509bcf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -360,17 +360,24 @@ def export_query():
content = make_xlsx(xlsx_data, "Query Report", column_widths=column_widths).getvalue()
for value in (data.filters or {}).values():
if len(report_name) > 200:
break
if isinstance(value, list) and value:
report_name += "_" + ",".join(value)
suffix = ""
if isinstance(value, list):
suffix = "_" + ",".join(value)
elif isinstance(value, str) and value not in {"Yes", "No"}:
report_name += f"_{value}"
suffix = f"_{value}"
if valid_report_name(report_name, suffix):
report_name += suffix
provide_binary_file(report_name, file_extension, content)
def valid_report_name(report_name, suffix):
if len(report_name) + len(suffix) < 200:
return True
return False
def format_fields(data: frappe._dict) -> None:
for i, col in enumerate(data.columns):
if col.get("fieldtype") == "Duration":