fix: restructure logic to generate report name
This commit is contained in:
parent
584f63c9b0
commit
a2ead69051
1 changed files with 8 additions and 9 deletions
|
|
@ -316,7 +316,6 @@ def export_query():
|
|||
|
||||
form_params = frappe._dict(frappe.local.form_dict)
|
||||
csv_params = pop_csv_params(form_params)
|
||||
print(form_params)
|
||||
clean_params(form_params)
|
||||
parse_json(form_params)
|
||||
|
||||
|
|
@ -361,14 +360,14 @@ def export_query():
|
|||
content = make_xlsx(xlsx_data, "Query Report", column_widths=column_widths).getvalue()
|
||||
|
||||
for value in (data.filters or {}).values():
|
||||
if isinstance(value, list) and valid_report_name(report_name, "_" + ",".join(value)):
|
||||
report_name += "_" + ",".join(value)
|
||||
elif (
|
||||
isinstance(value, str)
|
||||
and value not in {"Yes", "No"}
|
||||
and valid_report_name(report_name, f"_{value}")
|
||||
):
|
||||
report_name += f"_{value}"
|
||||
suffix = ""
|
||||
if isinstance(value, list):
|
||||
suffix = "_" + ",".join(value)
|
||||
elif isinstance(value, str) and value not in {"Yes", "No"}:
|
||||
suffix = f"_{value}"
|
||||
|
||||
if valid_report_name(report_name, suffix):
|
||||
report_name += suffix
|
||||
|
||||
provide_binary_file(report_name, file_extension, content)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue