From 30cd409d22a2e6aafab53a5f38edbb37a4a2f543 Mon Sep 17 00:00:00 2001 From: Denis Vermylen Date: Wed, 8 Mar 2023 07:16:31 +0000 Subject: [PATCH] [FIX] mail: websocket HTTP routes for guests When contacting the server through the /websocket route, self.env.uid is never set for the public user as we don't go through the `_auth_method_public` method. But through HTTP, it is set which is why guests were not subscribed to their channels as their self.env.uid corresponded to the public user. So we use request.session.uid instead, which remains unset for public users. closes odoo/odoo#114659 X-original-commit: 7059fdd2c8c36d6741d943ac2b61e971a4d05dcf Signed-off-by: Denis Vermylen (dve) --- addons/mail/models/ir_websocket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/ir_websocket.py b/addons/mail/models/ir_websocket.py index 9af56e5ed8b..0fdfc5400f2 100644 --- a/addons/mail/models/ir_websocket.py +++ b/addons/mail/models/ir_websocket.py @@ -24,7 +24,7 @@ class IrWebsocket(models.AbstractModel): channels = list(channels) # do not alter original list guest_sudo = self.env['mail.guest']._get_guest_from_request(req).sudo() mail_channels = self.env['mail.channel'] - if self.env.uid: + if req.session.uid: partner = self.env.user.partner_id mail_channels = partner.channel_ids channels.append(partner)