Hi everybody,
I would like to get result from my request "instance.web.Model", then call this.super(). The matter is that "instance.web.Model" is asynchronous, so in my case the super() will be called before the request has finished.
MyObject.extend({
init: function(parent, data){
var newData = instance.web.Model('advanced.search')
.call('check_duplication', [data]).done(function (name) {
// do stuff
return name
});
data = newData;
this._super.apply(this, arguments);
// super is called before my request is done so the new data are not sent to super.
}
});
Do you know how to get through that? In order to pass the newData instead data as argument to the super object.
PS : I tried to encapsulate this in self : var self = this; but it does not work because it seems the parent object I extend continue to run without waiting. So I got error like "self.super(... is not a function".
Odoo comes with jQuery BlockUI plugin. I believe, it can help you.
How to implement it? I tried some simple $.blockUI() -> $.unblockUI() but I cannot get the right behavior.
In odoo: instance.web.blockUI() and instance.web.unblockUI().
blockUI does not avoid super to be called before Model has done its request. If I try to deferred it tells me : "dict.widget.attrs is undefined". Whenever I try to call super only when request is done I got this error back