From e710e5df7a88b601f117c84d62930486b1d58415 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Mon, 5 Mar 2018 11:51:19 +0100 Subject: [PATCH] [FIX] web: show error when trying to export a report with more than 256 columns If the user tried to generate a report with more than 256 columns, he would get a traceback instead of an error message. Furthermore, if only one measure was selected, then the check was not done and the user would also get a traceback. opw-1816931 --- addons/web/static/src/js/views/pivot_view.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js index c874a87665f..40b18fff86c 100644 --- a/addons/web/static/src/js/views/pivot_view.js +++ b/addons/web/static/src/js/views/pivot_view.js @@ -803,7 +803,7 @@ var PivotView = View.extend({ framework.blockUI(); var nbr_measures = this.active_measures.length, headers = this.compute_headers(), - measure_row = nbr_measures > 1 ? _.last(headers) : [], + measure_row = nbr_measures >= 1 ? _.last(headers) : [], rows = this.compute_rows(), i, j, value; headers[0].splice(0,1); @@ -829,7 +829,8 @@ var PivotView = View.extend({ title: this.title, }; if(table.measure_row.length + 1 > 256) { - c.show_message(_t("For Excel compatibility, data cannot be exported if there are more than 256 columns.\n\nTip: try to flip axis, filter further or reduce the number of measures.")); + crash_manager.show_message(_t("For Excel compatibility, data cannot be exported if there are more than 256 columns.\n\nTip: try to flip axis, filter further or reduce the number of measures.")); + framework.unblockUI(); return; } session.get_file({