[FIX] Web: view_pivot.js: download table with one measure

The headers array contains 2 sub-arrays, whatever the number of
measures. The test on nbr_measures was thus incorrect and produced an
error when downloading a table with a single measure.

Also fix the typo in dow(n)load_table function name.
This commit is contained in:
Aaron Bohy
2015-02-20 12:44:19 +01:00
parent 5446d4ef6c
commit 5e936c111b
+4 -4
View File
@@ -71,7 +71,7 @@ instance.web.PivotView = instance.web.View.extend({
self.sidebar.appendTo(self.$sidebar);
self.sidebar.add_items('other', [{
label: _t("Download xls"),
callback: self.dowload_table.bind(self)
callback: self.download_table.bind(self)
}]);
}
});
@@ -199,7 +199,7 @@ instance.web.PivotView = instance.web.View.extend({
return this.toggle_measure(field);
}
if ($target.hasClass('oe-pivot-download')) {
return this.dowload_table();
return this.download_table();
}
},
on_open_header_click: function (event) {
@@ -731,7 +731,7 @@ instance.web.PivotView = instance.web.View.extend({
this.load_data().then(this.display_table.bind(this));
}
},
dowload_table: function () {
download_table: function () {
openerp.web.blockUI();
var nbr_measures = this.active_measures.length,
headers = this.compute_headers(),
@@ -754,7 +754,7 @@ instance.web.PivotView = instance.web.View.extend({
}
}
var table = {
headers: nbr_measures > 1 ? _.initial(headers) : headers,
headers: _.initial(headers),
measure_row: measure_row,
rows: rows,
nbr_measures: nbr_measures,