Merge pull request #9997 from prssanna/fix-export-hidden-column
fix(Reports): don't export hidden columns in reports
This commit is contained in:
commit
f0e8c0ae40
2 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue