summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/model_field_selector.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:32 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commitab56e637b7f97ddcdbcc9baea99ae097e342409c (patch)
tree4cb47da9f7ef89b19d18429220a7507470ec12a9 /addons/web/static/src/js/widgets/model_field_selector.js
parenteeed894fd50e477135e1ac9a82f6e98ce063ab90 (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/model_field_selector.js')
-rw-r--r--addons/web/static/src/js/widgets/model_field_selector.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/js/widgets/model_field_selector.js
index b8c953a2d0e..08a7ae47c81 100644
--- a/addons/web/static/src/js/widgets/model_field_selector.js
+++ b/addons/web/static/src/js/widgets/model_field_selector.js
@@ -112,17 +112,17 @@ var ModelFieldSelector = Widget.extend({
},
/**
* @see Widget.willStart()
- * @returns {Deferred}
+ * @returns {Promise}
*/
willStart: function () {
- return $.when(
+ return Promise.all([
this._super.apply(this, arguments),
this._prefill()
- );
+ ]);
},
/**
* @see Widget.start
- * @returns {Deferred}
+ * @returns {Promise}
*/
start: function () {
this.$value = this.$(".o_field_selector_value");
@@ -162,11 +162,11 @@ var ModelFieldSelector = Widget.extend({
* Saves a new field chain (array) and re-render.
*
* @param {string[]} chain - the new field chain
- * @returns {Deferred} resolved once the re-rendering is finished
+ * @returns {Promise} resolved once the re-rendering is finished
*/
setChain: function (chain) {
if (_.isEqual(chain, this.chain)) {
- return $.when();
+ return Promise.resolve();
}
this.chain = chain;
@@ -290,14 +290,14 @@ var ModelFieldSelector = Widget.extend({
* chain.
*
* @private
- * @returns {Deferred} resolved once the whole field chain has been
+ * @returns {Promise} resolved once the whole field chain has been
* processed
*/
_prefill: function () {
this.pages = [];
return this._pushPageData(this.model).then((function () {
this._validate(true);
- return (this.chain.length ? processChain.call(this, this.chain.slice().reverse()) : $.when());
+ return (this.chain.length ? processChain.call(this, this.chain.slice().reverse()) : Promise.resolve());
}).bind(this));
function processChain(chain) {
@@ -305,11 +305,11 @@ var ModelFieldSelector = Widget.extend({
if (field && field.relation && chain.length > 0) { // Fetch next chain node if any and possible
return this._pushPageData(field.relation).then(processChain.bind(this, chain));
} else if (field && chain.length === 0) { // Last node fetched
- return $.when();
+ return Promise.resolve();
} else { // Wrong node chain
this._validate(false);
}
- return $.when();
+ return Promise.resolve();
}
},
/**
@@ -318,12 +318,12 @@ var ModelFieldSelector = Widget.extend({
*
* @private
* @param {string} model - the model name whose fields have to be fetched
- * @returns {Deferred} resolved once the fields have been added
+ * @returns {Promise} resolved once the fields have been added
*/
_pushPageData: function (model) {
var def;
if (this.model === model && this.options.fields) {
- def = $.when(sortFields(this.options.fields, model, this.options.order));
+ def = Promise.resolve(sortFields(this.options.fields, model, this.options.order));
} else {
def = this._getModelFieldsFromCache(model, this.options.filters);
}