Skip to content

Commit

Permalink
[FIX] web: WebClient: notify the ActionManager it's in the DOM
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
msh-odoo authored and aab-odoo committed Jan 19, 2018
1 parent a4a54ab commit 7faecb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 10 additions & 2 deletions addons/web/static/src/js/chrome/abstract_web_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
}
},
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions addons/web/static/src/js/chrome/web_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7faecb6

Please sign in to comment.