From ff59e2409331e196fa4f1e45ce3e319ffda300bb Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 15 Feb 2017 22:57:41 +0100 Subject: [PATCH] [FIX] im_livechat: do not add public user to livechat channels Public users (website visitors) do not need to be part of a livechat channel to talk with the operator, they are using a dedicated mechanism. Explicitly including them is redundant and bloats the database. --- addons/im_livechat/models/im_livechat_channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/im_livechat/models/im_livechat_channel.py b/addons/im_livechat/models/im_livechat_channel.py index 2041697bd03..91e49b9babb 100644 --- a/addons/im_livechat/models/im_livechat_channel.py +++ b/addons/im_livechat/models/im_livechat_channel.py @@ -166,7 +166,7 @@ class ImLivechatChannel(models.Model): operator_partner_id = user.partner_id.id # partner to add to the mail.channel channel_partner_to_add = [(4, operator_partner_id)] - if self.env.uid: # if the user if logged (portal user), he can be identify + if self.env.user and self.env.user.active: # valid session user (not public) channel_partner_to_add.append((4, self.env.user.partner_id.id)) # create the session, and add the link with the given channel mail_channel = self.env["mail.channel"].with_context(mail_create_nosubscribe=False).sudo().create({