summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-02-15 22:57:41 +0100
committerOlivier Dony <odo@openerp.com>2017-05-05 17:02:46 +0200
commitff59e2409331e196fa4f1e45ce3e319ffda300bb (patch)
tree0a85ccfd6b475cf0d3b4f9e617ce3493ce9b720d
parent831a2a00e35bde8e47a1678b3156148381414392 (diff)
[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.
-rw-r--r--addons/im_livechat/models/im_livechat_channel.py2
1 files changed, 1 insertions, 1 deletions
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({