diff --git a/addons/mail/static/src/models/messaging/messaging.js b/addons/mail/static/src/models/messaging/messaging.js index 6f9caca64d16082c4bedf2104bbdb874ac1efd3e..b3e66f63b486e64439a858f20849f409bd0bb40a 100644 --- a/addons/mail/static/src/models/messaging/messaging.js +++ b/addons/mail/static/src/models/messaging/messaging.js @@ -12,7 +12,9 @@ function factory(dependencies) { * @override */ _willDelete() { - this.env.services['bus_service'].off('window_focus', null, this._handleGlobalWindowFocus); + if (this.env.services['bus_service']) { + this.env.services['bus_service'].off('window_focus', null, this._handleGlobalWindowFocus); + } return super._willDelete(...arguments); } 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 4ab9cfc98c38dab0f91e95a7b53d06de6726d5a7..dcd8b09f688ef14f49a001031d3dd4d926bb3b84 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); }