[FIX]mail: fix help command in livechat with unlogged user

When an unlogged user creates a livechat, typing the /help command in the
backend would result in the help command sending a traceback.
The function processing the command would assume the existence of a channel
partner name, which is not the case when the user starting the chat is unlogged.

opw:1835484
This commit is contained in:
len-odoo
2018-04-17 13:23:50 +02:00
committed by len-odoo
parent 866b48a267
commit 1777646d1e
+1 -1
View File
@@ -648,7 +648,7 @@ class Channel(models.Model):
msg += _(" This channel is private. People must be invited to join it.")
else:
channel_partners = self.env['mail.channel.partner'].search([('partner_id', '!=', partner.id), ('channel_id', '=', self.id)])
msg = _("You are in a private conversation with <b>@%s</b>.") % channel_partners[0].partner_id.name
msg = _("You are in a private conversation with <b>@%s</b>.") % (channel_partners[0].partner_id.name if channel_partners else _('Anonymous'))
msg += _("""<br><br>
You can mention someone by typing <b>@username</b>, this will grab its attention.<br>
You can mention a channel by typing <b>#channel</b>.<br>