diff options
| author | Simon Lejeune <sle@openerp.com> | 2016-08-26 18:03:53 +0200 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2016-08-26 18:16:35 +0200 |
| commit | 1871b33dbf0837e18342c78748cbd63b3b10dab2 (patch) | |
| tree | 11914380935c57121d09138e200c2f99f432991e /addons/web/static | |
| parent | f4738e7bb5d9f02cf7954270a8b3815156519909 (diff) | |
[IMP] web: export: keep compatible fields when switching export type
Previously all the fields were removed when switching export type, even
if they are available in the newly selected export type. This commit
fixes that.
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/widgets/data_export.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/addons/web/static/src/js/widgets/data_export.js b/addons/web/static/src/js/widgets/data_export.js index 14cdc4c5e3e..712adfb89e5 100644 --- a/addons/web/static/src/js/widgets/data_export.js +++ b/addons/web/static/src/js/widgets/data_export.js @@ -222,13 +222,22 @@ var DataExport = Dialog.extend({ var got_fields = new $.Deferred(); this.$import_compat_radios.change(function(e) { - self.$fields_list.empty(); self.$('.o_field_tree_structure').remove(); self.rpc("/web/export/get_fields", { model: self.dataset.model, import_compat: !!$(e.target).val(), }).done(function (records) { + var compatible_fields = _.map(records, function (record) {return record.id}); + self.$fields_list + .find('option') + .filter(function () { + var option_field = $(this).attr('value'); + if (compatible_fields.indexOf(option_field) === -1) { + return true; + } + }) + .remove(); got_fields.resolve(); self.on_show_data(records); }); |
