From 9a4b74aef82b4ee1a99eb1a0e8cef0e8e8caba87 Mon Sep 17 00:00:00 2001 From: Wolfgang Pichler Date: Sat, 22 Sep 2018 21:29:37 +0200 Subject: [PATCH] [FIX] Fixed inheritance bugs in web_notify. Did caused problems when used with other modules which do inherit from WebClient (web_auto_refresh) --- web_notify/README.rst | 1 + web_notify/static/src/js/web_client.js | 21 +++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/web_notify/README.rst b/web_notify/README.rst index ab0517e5..29059831 100644 --- a/web_notify/README.rst +++ b/web_notify/README.rst @@ -93,6 +93,7 @@ Contributors * Laurent Mignon * Serpent Consulting Services Pvt. Ltd. * Guewen Baconnier +* Wolfgang Pichler Maintainer ---------- diff --git a/web_notify/static/src/js/web_client.js b/web_notify/static/src/js/web_client.js index d87b52ff..88563832 100644 --- a/web_notify/static/src/js/web_client.js +++ b/web_notify/static/src/js/web_client.js @@ -44,6 +44,9 @@ WebClient.include({ ), init: function(parent, client_options){ this._super(parent, client_options); + this.channel_warning = 'notify_warning_' + this.session.uid; + this.channel_info = 'notify_info_' + this.session.uid; + }, reload_active_view: function(){ var action_manager = this.action_manager; @@ -57,23 +60,17 @@ WebClient.include({ }, show_application: function() { var res = this._super(); - this.start_polling(); + base_bus.bus.start_polling(); + base_bus.bus.add_channel(this.channel_warning); + base_bus.bus.add_channel(this.channel_info); + base_bus.bus.on('notification', this, this._web_notify_notification); return res }, on_logout: function() { - var self = this; - base_bus.bus.off('notification', this, this.bus_notification); + base_bus.bus.off('notification', this, this._web_notify_notification); this._super(); }, - start_polling: function() { - this.channel_warning = 'notify_warning_' + this.session.uid; - this.channel_info = 'notify_info_' + this.session.uid; - base_bus.bus.add_channel(this.channel_warning); - base_bus.bus.add_channel(this.channel_info); - base_bus.bus.on('notification', this, this.bus_notification); - base_bus.bus.start_polling(); - }, - bus_notification: function(notifications) { + _web_notify_notification: function (notifications) { var self = this; _.each(notifications, function (notification) { var channel = notification[0];