[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
This commit is contained in:
len-odoo
2018-03-05 12:56:27 +01:00
committed by Nicolas Martinelli
parent 554afff3ac
commit e710e5df7a
+3 -2
View File
@@ -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({