diff options
| author | Christophe Matthieu <chm@odoo.com> | 2018-02-06 11:17:06 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2018-02-08 15:46:41 +0100 |
| commit | 3b2127c690959e1e43063b09472028a69a62fcb2 (patch) | |
| tree | a4ec11fc358cc1e99865196673a86fc16d9b4762 | |
| parent | 3b9dda6106f9dd3eabd5dcb14f484a6072937dd6 (diff) | |
[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.
| -rw-r--r-- | addons/mail/static/src/js/chat_manager.js | 2 | ||||
| -rw-r--r-- | addons/point_of_sale/static/src/js/devices.js | 3 | ||||
| -rw-r--r-- | addons/pos_restaurant/static/src/js/multiprint.js | 3 | ||||
| -rw-r--r-- | addons/web/static/src/js/_deprecated/data.js | 1 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome/control_panel.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/core/bus.js | 5 | ||||
| -rw-r--r-- | addons/web/static/src/js/core/session.js | 3 |
7 files changed, 12 insertions, 7 deletions
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index 9d1b9cddb70..1a903525ada 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -626,7 +626,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; }); diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index bf11db31bf2..f06abc15c66 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -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; diff --git a/addons/pos_restaurant/static/src/js/multiprint.js b/addons/pos_restaurant/static/src/js/multiprint.js index dac0a906850..1a135bdfe03 100644 --- a/addons/pos_restaurant/static/src/js/multiprint.js +++ b/addons/pos_restaurant/static/src/js/multiprint.js @@ -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}); diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/js/_deprecated/data.js index be5496c55c7..eb70f330076 100644 --- a/addons/web/static/src/js/_deprecated/data.js +++ b/addons/web/static/src/js/_deprecated/data.js @@ -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; diff --git a/addons/web/static/src/js/chrome/control_panel.js b/addons/web/static/src/js/chrome/control_panel.js index 98ce7814b7a..6aace69cf8d 100644 --- a/addons/web/static/src/js/chrome/control_panel.js +++ b/addons/web/static/src/js/chrome/control_panel.js @@ -78,7 +78,7 @@ var ControlPanel = Widget.extend({ this.template = template; } - this.bus = new Bus(); + this.bus = new Bus(this); this.bus.on("update", this, this.update); }, /** diff --git a/addons/web/static/src/js/core/bus.js b/addons/web/static/src/js/core/bus.js index 1f715da4df1..5257453edab 100644 --- a/addons/web/static/src/js/core/bus.js +++ b/addons/web/static/src/js/core/bus.js @@ -10,8 +10,9 @@ var mixins = require('web.mixins'); * @class Bus */ return Class.extend(mixins.EventDispatcherMixin, { - init: function() { - mixins.EventDispatcherMixin.init.call(this, parent); + init: function (parent) { + mixins.EventDispatcherMixin.init.call(this); + this.setParent(parent); }, }); diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/js/core/session.js index c3181a7abe6..2a41e7da44d 100644 --- a/addons/web/static/src/js/core/session.js +++ b/addons/web/static/src/js/core/session.js @@ -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; |
