diff --git a/addons/im_livechat/static/src/js/models/website_livechat_message.js b/addons/im_livechat/static/src/js/models/website_livechat_message.js index 7ec9e4bc5a0..17634e11d2f 100644 --- a/addons/im_livechat/static/src/js/models/website_livechat_message.js +++ b/addons/im_livechat/static/src/js/models/website_livechat_message.js @@ -39,7 +39,7 @@ var WebsiteLivechatMessage = AbstractMessage.extend({ getAvatarSource: function () { var source = this._serverURL; if (this.hasAuthor()) { - source += '/web/image/res.partner/' + this.getAuthorID() + '/image_small?placeholder=user_placeholder.jpg'; + source += '/web/partner_image/' + this.getAuthorID(); } else { source += '/mail/static/src/img/smiley/avatar.jpg'; } diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 14a73720340..e5384c9b167 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1003,6 +1003,15 @@ class Binary(http.Controller): response.set_cookie('fileToken', token) return response + @http.route(['/web/partner_image', + '/web/partner_image/', + '/web/partner_image//', + '/web/partner_image////'], type='http', auth="public") + def content_image_partner(self, rec_id, field='image_small', model='res.partner', **kwargs): + # other kwargs are ignored on purpose + return self._content_image(id=rec_id, model='res.partner', field=field, + placeholder='user_placeholder.jpg') + @http.route(['/web/image', '/web/image/', '/web/image//', @@ -1023,7 +1032,17 @@ class Binary(http.Controller): def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas', filename_field='datas_fname', unique=None, filename=None, mimetype=None, download=None, width=0, height=0, crop=False, access_token=None, avoid_if_small=False, - upper_limit=False, placeholder='placeholder.png', **kw): + upper_limit=False, **kwargs): + # other kwargs are ignored on purpose + return self._content_image(xmlid=xmlid, model=model, id=id, field=field, + filename_field=filename_field, unique=unique, filename=filename, mimetype=mimetype, + download=download, width=width, height=height, crop=crop, access_token=access_token, + avoid_if_small=avoid_if_small, upper_limit=upper_limit) + + def _content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas', + filename_field='datas_fname', unique=None, filename=None, mimetype=None, + download=None, width=0, height=0, crop=False, access_token=None, avoid_if_small=False, + upper_limit=False, placeholder='placeholder.png', **kwargs): status, headers, content = request.env['ir.http'].binary_content( xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename, filename_field=filename_field, download=download, mimetype=mimetype,