Error handling if visible_index not found in query report (#3399)

This commit is contained in:
Manas Solanki 2017-05-30 15:21:50 +05:30 committed by Nabin Hait
parent 4f80f7633f
commit ecfd190044

View file

@ -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")