summaryrefslogtreecommitdiff
path: root/addons/mail/controllers
diff options
context:
space:
mode:
authorThanhDodeurOdoo <tso@odoo.com>2018-11-26 10:08:01 +0000
committerThanhDodeurOdoo <tso@odoo.com>2018-12-06 19:09:33 +0000
commit7d85ab1eac6dbf33d56c6a1f8bf7e9e12bb8008e (patch)
treef977a392fe9e9fe9a21c06d997c0d5b877cbce76 /addons/mail/controllers
parent89f20d2c297d99d4eb0ded8be78fbf86b8ec45d3 (diff)
[REF] base, *: refactor binary_content
*: tools, web, website, website_forum, mail, im_livechat This commit refactors ir_http to make it more readable and flexible. Move the resize function of web/image to odoo.tools Co-authored-by: XavierDo <xdo@odoo.com> Co-authored-by: Antony Lesuisse <al@openerp.com> closes: #28563 task: #1908896
Diffstat (limited to 'addons/mail/controllers')
-rw-r--r--addons/mail/controllers/main.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index 6694fbf72b1..38965dcf79b 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -9,7 +9,6 @@ import werkzeug
from werkzeug import url_encode
from odoo import api, http, registry, SUPERUSER_ID, _
-from odoo.addons.web.controllers.main import binary_content
from odoo.exceptions import AccessError
from odoo.http import request
from odoo.tools import consteq
@@ -216,7 +215,8 @@ 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=SUPERUSER_ID))
+ status, headers, _content = request.env['ir.http'].sudo().binary_content(
+ model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png')
# binary content return an empty string and not a placeholder if obj[field] is False
if _content != '':
content = _content