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/domain_selector.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/domain_selector.js')
| -rw-r--r-- | addons/web/static/src/js/widgets/domain_selector.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/js/widgets/domain_selector.js index 8e20e1ce18d..ed71679699c 100644 --- a/addons/web/static/src/js/widgets/domain_selector.js +++ b/addons/web/static/src/js/widgets/domain_selector.js @@ -188,11 +188,14 @@ var DomainTree = DomainNode.extend({ }, /** * @see DomainNode.start - * @returns {Deferred} + * @returns {Promise} */ start: function () { this._postRender(); - return $.when(this._super.apply(this, arguments), this._renderChildrenTo(this.$childrenContainer)); + return Promise.all([ + this._super.apply(this, arguments), + this._renderChildrenTo(this.$childrenContainer) + ]); }, //-------------------------------------------------------------------------- @@ -369,11 +372,11 @@ var DomainTree = DomainNode.extend({ * * @private * @param {jQuery} $to - the jQuery node to which the children must be added - * @returns {Deferred} + * @returns {Promise} */ _renderChildrenTo: function ($to) { var $div = $("<div/>"); - return $.when.apply($, _.map(this.children, (function (child) { + return Promise.all(_.map(this.children, (function (child) { return child.appendTo($div); }).bind(this))).then((function () { _.each(this.children, function (child) { @@ -485,11 +488,11 @@ var DomainSelector = DomainTree.extend({ * does nothing. * * @param {string} domain - * @returns {Deferred} resolved when the rerendering is finished + * @returns {Promise} resolved when the rerendering is finished */ setDomain: function (domain) { if (domain === Domain.prototype.arrayToString(this.getDomain())) { - return $.when(); + return Promise.resolve(); } var parsedDomain = this._parseDomain(domain); if (parsedDomain) { @@ -542,7 +545,7 @@ var DomainSelector = DomainTree.extend({ * This method is ugly but achieves the right behavior without flickering. * * @param {Array|string} domain - * @returns {Deferred} + * @returns {Promise} */ _redraw: function (domain) { var oldChildren = this.children.slice(); @@ -637,7 +640,7 @@ var DomainLeaf = DomainNode.extend({ * Prepares the information the rendering of the widget will need by * pre-instantiating its internal field selector widget. * - * @returns {Deferred} + * @returns {Promise} */ willStart: function () { var defs = [this._super.apply(this, arguments)]; @@ -702,17 +705,17 @@ var DomainLeaf = DomainNode.extend({ }).bind(this))); } - return $.when.apply($, wDefs); + return Promise.all(wDefs); } }).bind(this))); - return $.when.apply($, defs); + return Promise.all(defs); }, /** * @see DomainNode.start * Appends the prepared field selector and value widget. * - * @returns {Deferred} + * @returns {Promise} */ start: function () { this.fieldSelector.$el.prependTo(this.$("> .o_domain_leaf_info, > .o_domain_leaf_edition")); // place the field selector |
