[FIX] im_chat : enable chat widget only for base.group_user

This commit is contained in:
Jérome Maes 2014-09-04 14:26:07 +02:00
parent c9a134b541
commit 2942492245
1 changed files with 12 additions and 7 deletions

View File

@ -582,13 +582,18 @@
openerp.web.UserMenu.include({ openerp.web.UserMenu.include({
do_update: function(){ do_update: function(){
var self = this; var self = this;
this.update_promise.then(function() { var Users = new openerp.web.Model('res.users');
var im = new openerp.im_chat.InstantMessaging(self); Users.call('has_group', ['base.group_user']).done(function(is_employee) {
openerp.im_chat.single = im; if (is_employee) {
im.appendTo(openerp.client.$el); self.update_promise.then(function() {
var button = new openerp.im_chat.ImTopButton(this); var im = new openerp.im_chat.InstantMessaging(self);
button.on("clicked", im, im.switch_display); openerp.im_chat.single = im;
button.appendTo(window.$('.oe_systray')); im.appendTo(openerp.client.$el);
var button = new openerp.im_chat.ImTopButton(this);
button.on("clicked", im, im.switch_display);
button.appendTo(window.$('.oe_systray'));
});
}
}); });
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },