Skip to content
Permalink
Browse files

[IMP] mail: display country name with a known partner

Related Task ID: 1940407
  • Loading branch information...
kma-odoo committed Mar 15, 2019
1 parent 1f68cb8 commit 52426f7cf2c874517315a270cda45e8abcf89b9b
Showing with 3 additions and 3 deletions.
  1. +3 −3 addons/im_livechat/models/mail_channel.py
@@ -89,7 +89,7 @@ def channel_info(self, extra_info=False):
if channel.livechat_operator_id:
channel_infos_dict[channel.id]['operator_pid'] = channel.livechat_operator_id.with_context(im_livechat_use_username=True).name_get()[0]
# add the anonymous or partner name
channel_infos_dict[channel.id]['correspondent_name'] = channel._channel_get_livechat_partner_name()
channel_infos_dict[channel.id]['correspondent_name'] = channel._channel_get_livechat_partner_name_country()
last_msg = self.env['mail.message'].search([("channel_ids", "in", [channel.id])], limit=1)
if last_msg:
channel_infos_dict[channel.id]['last_message_date'] = last_msg.date
@@ -102,11 +102,11 @@ def channel_fetch_slot(self):
values['channel_livechat'] = self.search([('channel_type', '=', 'livechat'), ('id', 'in', pinned_channels.ids)]).channel_info()
return values

def _channel_get_livechat_partner_name(self):
def _channel_get_livechat_partner_name_country(self):
if self.livechat_operator_id in self.channel_partner_ids:
partners = self.channel_partner_ids - self.livechat_operator_id
if partners:
return ', '.join(partners.mapped('name'))
return ', '.join(partners.mapped('name')) + ' (' + partners.mapped('country_id').name + ')' if partners.mapped('country_id') else ''
if self.anonymous_name:
return self.anonymous_name
return _("Visitor")

0 comments on commit 52426f7

Please sign in to comment.
You can’t perform that action at this time.