summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/messaging_notification_handler
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2021-02-25 11:09:12 +0000
committerAlexandre Kühn <aku@odoo.com>2021-02-25 11:18:27 +0000
commita444f9c89bb8d5790b8a068a8f120f6ea9d1b17f (patch)
tree10a40f809d86c4ff9b6335a116fbf5b32546fe84 /addons/mail/static/src/models/messaging_notification_handler
parent2c38dc6e34ebb8d4590adead74ebf02fee40d66a (diff)
[FIX] mail: this.env.services.bus_service is undefined
Before this commit, a page reload or a redirect could raise following error: ``` Uncaught (in promise) TypeError: this.env.services.bus_service is undefined ``` This happens due to `Messaging` model relying on `bus_service` in its teardown method `_willDelete`. This is sometimes unsafe because the bus service may not have been deployed yet. Task-2468469 closes odoo/odoo#66818 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/messaging_notification_handler')
-rw-r--r--addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
index 564337846e6..6f0b316d131 100644
--- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
+++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
@@ -16,8 +16,10 @@ function factory(dependencies) {
* @override
*/
_willDelete() {
- this.env.services['bus_service'].off('notification');
- this.env.services['bus_service'].stopPolling();
+ if (this.env.services['bus_service']) {
+ this.env.services['bus_service'].off('notification');
+ this.env.services['bus_service'].stopPolling();
+ }
return super._willDelete(...arguments);
}