diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index e1c570e341..bf38eea6a8 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -129,6 +129,8 @@ def export_query(): file_format_type = data["file_format_type"] if isinstance(data.get("visible_idx"), basestring): visible_idx = json.loads(data.get("visible_idx")) + else: + visible_idx = None if file_format_type == "Excel": @@ -154,7 +156,8 @@ def export_query(): result = result + data.result # filter rows by slickgrid's inline filter - result = [x for idx, x in enumerate(result) if idx == 0 or idx in visible_idx] + if visible_idx: + result = [x for idx, x in enumerate(result) if idx == 0 or idx in visible_idx] from frappe.utils.xlsxutils import make_xlsx xlsx_file = make_xlsx(result, "Query Report")