From 640fa1d1c37879e25e6245d7985272a9b79b658e Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Wed, 29 Sep 2021 11:22:51 +0000 Subject: [PATCH] [FIX] mail: ensure guest is in the context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update a specific flow to ensure the record on which session_info is called has guest in its context. This is needed because session_info performs some checks on guest to determine if it should add translations data. closes odoo/odoo#77433 X-original-commit: bd0940cdbf43131ed8436a5deb3f8afebfbc37ab Signed-off-by: Sébastien Theys (seb) --- addons/mail/controllers/discuss.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mail/controllers/discuss.py b/addons/mail/controllers/discuss.py index 732929748c5..9fda98fe598 100644 --- a/addons/mail/controllers/discuss.py +++ b/addons/mail/controllers/discuss.py @@ -75,7 +75,10 @@ class DiscussController(http.Controller): 'isChannelTokenSecret': is_channel_token_secret, } add_guest_cookie = False - if not channel_sudo.env['mail.channel.partner']._get_as_sudo_from_request(request=request, channel_id=channel_sudo.id): + channel_partner_sudo = channel_sudo.env['mail.channel.partner']._get_as_sudo_from_request(request=request, channel_id=channel_sudo.id) + if channel_partner_sudo: + channel_sudo = channel_partner_sudo.channel_id # ensure guest is in context + else: if not channel_sudo.env.user._is_public(): channel_sudo.add_members([channel_sudo.env.user.partner_id.id]) else: