[FIX] web: properly set parent when using mixins

The parentedMixin doesn't automatically set the parent, so when this mixin
is used, the parent must be set manually. This wasn't done at several places,
and thus those elements weren't destroyed with their actual parent.

In master, we should probably make the ParentedMixin set the parent itself.
This commit is contained in:
Christophe Matthieu
2018-02-08 15:45:30 +01:00
parent 83795d37f3
commit 4f5fc6ee55
7 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -611,7 +611,7 @@ var ChatManager = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
Mixins.EventDispatcherMixin.init.call(this);
this.setParent(parent);
this.bus = new Bus();
this.bus = new Bus(this);
this.bus.on('client_action_open', null, function (open) {
client_action_open = open;
});
@@ -93,8 +93,9 @@ var JobQueue = function(){
var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{
init: function(parent,options){
mixins.PropertiesMixin.init.call(this,parent);
mixins.PropertiesMixin.init.call(this);
var self = this;
this.setParent(parent);
options = options || {};
this.pos = parent;
@@ -11,7 +11,8 @@ var QWeb = core.qweb;
var Printer = core.Class.extend(mixins.PropertiesMixin,{
init: function(parent,options){
mixins.PropertiesMixin.init.call(this,parent);
mixins.PropertiesMixin.init.call(this);
this.setParent(parent);
options = options || {};
var url = options.url || 'http://localhost:8069';
this.connection = new Session(undefined,url, { use_cors: true});
@@ -314,6 +314,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, {
*/
init: function (parent, model, context) {
mixins.PropertiesMixin.init.call(this);
this.setParent(parent);
this.model = model;
this.context = context || {};
this.index = null;
@@ -47,7 +47,7 @@ var ControlPanel = Widget.extend({
this.template = template;
}
this.bus = new Bus();
this.bus = new Bus(this);
this.bus.on("update", this, this.update);
},
/**
+3 -2
View File
@@ -8,8 +8,9 @@ var mixins = require('web.mixins');
* Event Bus used to bind events scoped in the current instance
*/
return Class.extend(mixins.EventDispatcherMixin, {
init: function() {
mixins.EventDispatcherMixin.init.call(this, parent);
init: function (parent) {
mixins.EventDispatcherMixin.init.call(this);
this.setParent(parent);
},
});
+2 -1
View File
@@ -28,7 +28,8 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
"override_session" is set to true.
*/
init: function (parent, origin, options) {
mixins.EventDispatcherMixin.init.call(this, parent);
mixins.EventDispatcherMixin.init.call(this);
this.setParent(parent);
options = options || {};
this.module_list = (options.modules && options.modules.slice()) || (window.odoo._modules && window.odoo._modules.slice()) || [];
this.server = null;