From 33b25edc78702a1c11f14f912c2eafed4e0ed5ac Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 16 Jan 2012 10:53:37 +0100 Subject: [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 --- addons/web/static/src/js/data_export.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'addons/web/static/src/js/data_export.js') 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 }); -- cgit v1.2.3