diff options
| author | Vincent Schippefilt <vsc@odoo.com> | 2019-03-06 14:02:32 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2019-03-06 20:07:17 +0100 |
| commit | ab56e637b7f97ddcdbcc9baea99ae097e342409c (patch) | |
| tree | 4cb47da9f7ef89b19d18429220a7507470ec12a9 /addons/web/static/src/js/widgets/data_export.js | |
| parent | eeed894fd50e477135e1ac9a82f6e98ce063ab90 (diff) | |
[REF] web: adapt code after jQuery update
Part of task 1896658
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/widgets/data_export.js')
| -rw-r--r-- | addons/web/static/src/js/widgets/data_export.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/addons/web/static/src/js/widgets/data_export.js b/addons/web/static/src/js/widgets/data_export.js index e24818f7336..a913fcd0ea2 100644 --- a/addons/web/static/src/js/widgets/data_export.js +++ b/addons/web/static/src/js/widgets/data_export.js @@ -56,7 +56,7 @@ var DataExport = Dialog.extend({ */ start: function () { var self = this; - var defs = [this._super.apply(this, arguments)]; + var proms = [this._super.apply(this, arguments)]; // The default for the ".modal_content" element is "max-height: 100%;" // but we want it to always expand to "height: 100%;" for this modal. @@ -67,10 +67,10 @@ var DataExport = Dialog.extend({ this.$fieldsList = this.$('.o_fields_list'); this.$importCompatRadios = this.$('.o_import_compat input'); - defs.push(this._rpc({route: '/web/export/formats'}).then(doSetupExportFormats)); - defs.push(this._onChangeCompatibleInput()); + proms.push(this._rpc({route: '/web/export/formats'}).then(doSetupExportFormats)); + proms.push(this._onChangeCompatibleInput()); - defs.push(this.getParent().getActiveDomain().then(function (domain) { + proms.push(this.getParent().getActiveDomain().then(function (domain) { if (domain === undefined) { self.idsToExport = self.getParent().getSelectedIds(); self.domain = self.record.domain; @@ -80,7 +80,7 @@ var DataExport = Dialog.extend({ } })); - defs.push(this._showExportsList().then(function () { + proms.push(this._showExportsList().then(function () { _.each(self.records, function (record, key) { if (_.contains(self.defaultExportFields, key)) { self._addField(key, record.string); @@ -88,12 +88,12 @@ var DataExport = Dialog.extend({ }); })); - return $.when.apply($, defs); + return Promise.all(proms); - function doSetupExportFormats (formats) { + function doSetupExportFormats(formats) { var $fmts = self.$('.o_export_format'); - _.each(formats, function (format, i) { + _.each(formats, function (format) { var $radio = $('<input/>', {type: 'radio', value: format.tag, name: 'o_export_format_name'}); var $label = $('<span/>', {html: format.label}); @@ -192,16 +192,16 @@ var DataExport = Dialog.extend({ */ _onExpandAction: function (record) { var self = this; - if (!record['children']) { + if (!record.children) { return; } - var model = record['params']['model']; - var prefix = record['params']['prefix']; - var name = record['params']['name']; + var model = record.params.model; + var prefix = record.params.prefix; + var name = record.params.name; var excludeFields = []; - if (record['relation_field']) { - excludeFields.push(record['relation_field']); + if (record.relation_field) { + excludeFields.push(record.relation_field); } if (!record.loaded) { @@ -212,11 +212,11 @@ var DataExport = Dialog.extend({ prefix: prefix, parent_name: name, import_compat: !!this.$importCompatRadios.filter(':checked').val(), - parent_field_type: record['field_type'], - parent_field: record['params']['parent_field'], + parent_field_type: record.field_type, + parent_field: record.params.parent_field, exclude: excludeFields, }, - }).done(function (results) { + }).then(function (results) { record.loaded = true; self._onShowData(results, record.id); }); @@ -294,7 +294,7 @@ var DataExport = Dialog.extend({ var self = this; if (this.$('.o_exported_lists_select').is(':hidden')) { this.$('.o_exported_lists').show(); - return $.when(); + return Promise.resolve(); } return this._rpc({ @@ -355,7 +355,7 @@ var DataExport = Dialog.extend({ model: this.record.model, import_compat: this.isCompatibleMode, }, - }).done(function (records) { + }).then(function (records) { var compatibleFields = _.map(records, function (record) { return record.id; }); self.$fieldsList .find('option') |
