summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2016-07-05 11:27:18 +0200
committerJeremy Kersten <jke@odoo.com>2016-07-05 12:34:06 +0200
commitc6e7e2d2aacbaf6c3685ae30b45a01ecf5d1a426 (patch)
tree9740004694910e88699244c86e934f566dcef108 /addons
parentd7438709203f87e65ee536b6299d6beb7362669f (diff)
[FIX] mail: controller avatar return placeholder if no content
binary_content return '' if no picture, so, we keep the placeholder if no image has been returned. It avoid in the new portal with discuss widget to get the default browser 404 picture (file broken) This commit close #12683
Diffstat (limited to 'addons')
-rw-r--r--addons/mail/controllers/main.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index c67238e46d0..320020d2c6f 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -222,7 +222,10 @@ class MailController(http.Controller):
# if the current user has access to the document, get the partner avatar as sudo()
request.env[res_model].browse(res_id).check_access_rule('read')
if partner_id in request.env[res_model].browse(res_id).sudo().exists().message_ids.mapped('author_id').ids:
- status, headers, content = binary_content(model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png', env=request.env(user=openerp.SUPERUSER_ID))
+ status, headers, _content = binary_content(model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png', env=request.env(user=openerp.SUPERUSER_ID))
+ # binary content return an empty string and not a placeholder if obj[field] is False
+ if _content != '':
+ content = _content
if status == 304:
return werkzeug.wrappers.Response(status=304)
except AccessError: