Skip to content

Commit

Permalink
Merge pull request #10 from 8848digital/fix_excel_export_issue
Browse files Browse the repository at this point in the history
fix: Fixing the excel and csv file export issue
  • Loading branch information
Satya8848 authored Oct 16, 2024
2 parents bfb7b5a + d7e4990 commit 7770d62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frappe/desk/reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ def export_query():
if add_totals_row:
ret = append_totals_row(ret)

fields_info = get_field_info(db_query.fields, doctype)
cleaned_fields = [field.split('cast(')[-1].split(' as ')[0].strip() if 'cast(' in field else field
for field in db_query.fields ]
fields_info = get_field_info(cleaned_fields, doctype)

labels = [info["label"] for info in fields_info]
data = [[_("Sr"), *labels]]
Expand All @@ -395,7 +397,7 @@ def export_query():
processed_data.append(processed_row)
data.extend(processed_data)

data = handle_duration_fieldtype_values(doctype, data, db_query.fields)
data = handle_duration_fieldtype_values(doctype, data,cleaned_fields)

if file_format_type == "CSV":
from frappe.utils.xlsxutils import handle_html
Expand Down

0 comments on commit 7770d62

Please sign in to comment.