diff --git a/addons/live_support/static/ext/static/js/livesupport.js b/addons/live_support/static/ext/static/js/livesupport.js index 3f5238310e5..c2804b0454e 100644 --- a/addons/live_support/static/ext/static/js/livesupport.js +++ b/addons/live_support/static/ext/static/js/livesupport.js @@ -91,8 +91,8 @@ define(["nova", "jquery", "underscore", "oeclient", "require"], function(nova, $ __init__: function(parent, user_rec) { nova.DynamicProperties.__init__.call(this, parent); user_rec.image_url = require.toUrl("../img/avatar/avatar.jpeg"); - //if (user_rec.user) - // user_rec.image_url = instance.session.url('/web/binary/image', {model:'res.users', field: 'image_small', id: user_rec.user[0]}); + if (user_rec.image) + user_rec.image_url = "data:image/png;base64," + user_rec.image; this.set(user_rec); this.set("watcher_count", 0); this.on("change:watcher_count", this, function() { diff --git a/addons/web_im/im.py b/addons/web_im/im.py index eeddca248cf..bba1b96d550 100644 --- a/addons/web_im/im.py +++ b/addons/web_im/im.py @@ -307,6 +307,7 @@ class im_user(osv.osv): _columns = { 'name': fields.related('user', 'name', type='char', size=200, string="Name", store=True, readonly=True), + 'image': fields.related('user', 'image_small', type='binary', string="Image", readonly=True), 'user': fields.many2one("res.users", string="User", select=True, ondelete='cascade'), 'uuid': fields.char(string="UUID", size=50, select=True), 'im_last_received': fields.integer(string="Instant Messaging Last Received Message"), diff --git a/addons/web_im/static/src/js/im.js b/addons/web_im/static/src/js/im.js index 3f43b813fba..9cb70e7d21c 100644 --- a/addons/web_im/static/src/js/im.js +++ b/addons/web_im/static/src/js/im.js @@ -79,7 +79,7 @@ openerp.web_im = function(instance) { var self = this; return this.user_search_dm.add(users.call("search_users", [[["name", "ilike", this.get("current_search")], ["id", "<>", instance.session.uid]], - [], USERS_LIMIT], {context:new instance.web.CompoundContext()})).then(function(result) { + ["name", "user", "uuid", "im_status"], USERS_LIMIT], {context:new instance.web.CompoundContext()})).then(function(result) { self.c_manager.add_to_user_cache(result); self.$(".oe_im_input").val(""); var old_users = self.users; @@ -233,7 +233,7 @@ openerp.web_im = function(instance) { if (_.size(no_cache) === 0) return $.when(); else - return new instance.web.Model("im.user").call("read", [_.values(no_cache), []], + return new instance.web.Model("im.user").call("read", [_.values(no_cache), ["name", "user", "uuid", "im_status"]], {context: new instance.web.CompoundContext()}).then(function(users) { self.add_to_user_cache(users); });