summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data_export.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-01-16 10:53:37 +0100
committerXavier Morel <xmo@openerp.com>2012-01-16 10:53:37 +0100
commit33b25edc78702a1c11f14f912c2eafed4e0ed5ac (patch)
tree5095fbefb84d24da21c9b0093deeec40cc935458 /addons/web/static/src/js/data_export.js
parent61b4bedcab59c8a761ba978ea8d9cfaa9df9d326 (diff)
[FIX] fetching of export data after reloading from saved list in a different mode than original
If a field name can not be found in the `records` mapping, use it as-is. May fail in some cases (for nested id fields) but will generally work better when reloading a list created in "all" mode while in "export compatible" mode, as there may be saved fields missing from the currently available list. Better fixes would be: * Ignore (gray out?) unavailable fields for this mode (and re-allow when the mode changes) * Display an error message of some sort and refuse to load the list * Pre-load all export lists and filter selectable ones by mode lp bug: https://launchpad.net/bugs/915245 fixed bzr revid: xmo@openerp.com-20120116095337-ko0y6xha6oqx4vw1
Diffstat (limited to 'addons/web/static/src/js/data_export.js')
-rw-r--r--addons/web/static/src/js/data_export.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js
index 1268ac67fa5..f065c996abe 100644
--- a/addons/web/static/src/js/data_export.js
+++ b/addons/web/static/src/js/data_export.js
@@ -362,11 +362,12 @@ openerp.web.DataExport = openerp.web.Dialog.extend({
return export_field;
},
on_click_export_data: function() {
- var exported_fields = [], self = this;
- this.$element.find("#fields_list option").each(function() {
- var fieldname = self.records[$(this).val()];
- exported_fields.push({name: fieldname, label: $(this).text()});
- });
+ var exported_fields = this.$element.find('#fields_list option').map(function () {
+ // DOM property is textContent, but IE8 only knows innerText
+ return {name: this.value,
+ label: this.textContent || this.innerText};
+ }).get();
+
if (_.isEmpty(exported_fields)) {
alert(_t("Please select fields to export..."));
return;
@@ -383,7 +384,7 @@ openerp.web.DataExport = openerp.web.Dialog.extend({
ids: this.dataset.ids,
domain: this.dataset.domain,
import_compat: Boolean(
- this.$element.find("#import_compat").val())
+ this.$element.find("#import_compat").val())
})},
complete: $.unblockUI
});