added image for anonymous

bzr revid: nicolas.vanhoren@openerp.com-20130205152840-pvkt0f5yjf8jxcg9
This commit is contained in:
niv-openerp
2013-02-05 16:28:40 +01:00
parent 86db332967
commit f1b65176bb
3 changed files with 5 additions and 4 deletions
@@ -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() {
+1
View File
@@ -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"),
+2 -2
View File
@@ -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);
});