Merge pull request #9997 from prssanna/fix-export-hidden-column

fix(Reports): don't export hidden columns in reports
This commit is contained in:
Shivam Mishra 2020-04-20 16:49:06 +05:30 committed by GitHub
commit f0e8c0ae40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -299,6 +299,7 @@ def export_query():
_("You can try changing the filters of your report."))
return
data.columns = [col for col in data.columns if isinstance(col, dict) and not col.get('hidden')]
columns = get_columns_dict(data.columns)
from frappe.utils.xlsxutils import make_xlsx
@ -310,7 +311,7 @@ def export_query():
frappe.response['type'] = 'binary'
def build_xlsx_data(columns, data, visible_idx,include_indentation):
def build_xlsx_data(columns, data, visible_idx, include_indentation):
result = [[]]
# add column headings

View file

@ -1084,7 +1084,12 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
], ({ file_format, include_indentation }) => {
this.make_access_log('Export', file_format);
if (file_format === 'CSV') {
const column_row = this.columns.map(col => col.label);
const column_row = this.columns.reduce((acc, col) => {
if (!col.hidden) {
acc.push(col.label);
}
return acc;
}, []);
const data = this.get_data_for_csv(include_indentation);
const out = [column_row].concat(data);