[FIX] web: WebClient: notify the ActionManager it's in the DOM

Before this rev., on_attach_callback of the ActionManager wasn't
called at init, because the WebClient didn't use the append
function of dom_utils.
This commit is contained in:
Mohammed Shekha
2018-01-19 14:31:05 +01:00
committed by Aaron Bohy
parent a4a54ab838
commit 7faecb6fe4
2 changed files with 10 additions and 5 deletions
@@ -18,6 +18,7 @@ var config = require('web.config');
var crash_manager = require('web.crash_manager');
var data_manager = require('web.data_manager');
var Dialog = require('web.Dialog');
var dom = require('web.dom');
var Loading = require('web.Loading');
var mixins = require('web.mixins');
var NotificationManager = require('web.NotificationManager');
@@ -46,7 +47,7 @@ var AbstractWebClient = Widget.extend(mixins.ServiceProvider, {
// notifications, warnings and effects
notification: function (e) {
if(this.notification_manager) {
if (this.notification_manager) {
this.notification_manager.notify(e.data.title, e.data.message, e.data.sticky);
}
},
@@ -201,8 +202,15 @@ var AbstractWebClient = Widget.extend(mixins.ServiceProvider, {
};
},
set_action_manager: function () {
var self = this;
this.action_manager = new ActionManager(this, session.user_context);
return this.action_manager.appendTo(this.$('.o_main_content'));
var fragment = document.createDocumentFragment();
return this.action_manager.appendTo(fragment).then(function () {
dom.append(self.$('.o_main_content'), fragment, {
in_DOM: true,
callbacks: [{widget: self.action_manager}],
});
});
},
set_notification_manager: function () {
this.notification_manager = new NotificationManager(this);
@@ -23,9 +23,6 @@ return AbstractWebClient.extend({
show_application: function() {
var self = this;
// Allow to call `on_attach_callback` and `on_detach_callback` when needed
this.action_manager.is_in_DOM = true;
this.toggle_bars(true);
this.set_title();
this.update_logo();