diff --git a/addons/im_livechat/models/im_livechat_channel.py b/addons/im_livechat/models/im_livechat_channel.py index 5f9db25f65e..d6e23c282cd 100644 --- a/addons/im_livechat/models/im_livechat_channel.py +++ b/addons/im_livechat/models/im_livechat_channel.py @@ -120,7 +120,7 @@ class ImLivechatChannel(models.Model): 'anonymous_name': False if user_id else anonymous_name, 'country_id': country_id, 'channel_type': 'livechat', - 'name': ', '.join([visitor_user.name if visitor_user else anonymous_name, operator.livechat_username if operator.livechat_username else operator.name]), + 'name': ', '.join([visitor_user.display_name if visitor_user else anonymous_name, operator.livechat_username if operator.livechat_username else operator.name]), 'public': 'private', 'email_send': False, } diff --git a/addons/im_livechat/tests/test_get_mail_channel.py b/addons/im_livechat/tests/test_get_mail_channel.py index 113fb604a6e..a978c32206a 100644 --- a/addons/im_livechat/tests/test_get_mail_channel.py +++ b/addons/im_livechat/tests/test_get_mail_channel.py @@ -53,7 +53,7 @@ class TestGetMailChannel(TransactionCase): self.assertTrue(all(partner_id in channel_operator_ids for partner_id in self.operators.mapped('partner_id').ids)) visitor_user_channel = self.livechat_channel._open_livechat_mail_channel('Visitor', user_id=self.visitor_user.id) - chat_title = '%s (%s)' % (self.visitor_user.name, self.visitor_user.country_id.name) + chat_title = '%s (%s)' % (self.visitor_user.display_name, self.visitor_user.country_id.name) self.assertEqual(visitor_user_channel['correspondent_name'], chat_title, "Chat title should be correct and should contain visitor's country name") def _open_livechat_mail_channel(self): diff --git a/addons/website_livechat/models/im_livechat_channel.py b/addons/website_livechat/models/im_livechat_channel.py index dd083c6e104..fb1648a9808 100644 --- a/addons/website_livechat/models/im_livechat_channel.py +++ b/addons/website_livechat/models/im_livechat_channel.py @@ -16,7 +16,7 @@ class ImLivechatChannel(models.Model): 'livechat_active': True }) if not user_id: - mail_channel_vals['anonymous_name'] = visitor_sudo.name + (' (%s)' % visitor_sudo.country_id.name if visitor_sudo.country_id else '') + mail_channel_vals['anonymous_name'] = visitor_sudo.display_name + (' (%s)' % visitor_sudo.country_id.name if visitor_sudo.country_id else '') # As chat requested by the visitor, delete the chat requested by an operator if any to avoid conflicts between two flows chat_request_channel = self.env['mail.channel'].sudo().search([('livechat_visitor_id', '=', visitor_sudo.id), ('livechat_active', '=', True)]) for mail_channel in chat_request_channel: diff --git a/addons/website_livechat/models/mail_channel.py b/addons/website_livechat/models/mail_channel.py index 48d6d08a847..2eb94f89f8d 100644 --- a/addons/website_livechat/models/mail_channel.py +++ b/addons/website_livechat/models/mail_channel.py @@ -34,7 +34,7 @@ class MailChannel(models.Model): visitor = channel.livechat_visitor_id if visitor: channel_infos_dict[channel.id]['visitor'] = { - 'name': visitor.name, + 'name': visitor.display_name, 'country_code': visitor.country_id.code.lower() if visitor.country_id else False, 'is_connected': visitor.is_connected, 'history': self._get_visitor_history(visitor), @@ -67,7 +67,7 @@ class MailChannel(models.Model): if not self.channel_message_ids: return # Notify that the visitor has left the conversation - name = _('The visitor') if not self.livechat_visitor_id else self.livechat_visitor_id.name + name = _('The visitor') if not self.livechat_visitor_id else self.livechat_visitor_id.display_name if type == 'cancel': message = _('has started a conversation with %s. The chat request has been canceled.') % kwargs.get('speaking_with', 'an operator') else: diff --git a/addons/website_livechat/models/website_visitor.py b/addons/website_livechat/models/website_visitor.py index e4020760f8f..84d52f54d47 100644 --- a/addons/website_livechat/models/website_visitor.py +++ b/addons/website_livechat/models/website_visitor.py @@ -54,7 +54,7 @@ class WebsiteVisitor(models.Model): for visitor in self: operator = self.env.user country = visitor.country_id - visitor_name = "%s (%s)" % (visitor.name, country.name) if country else visitor.name + visitor_name = "%s (%s)" % (visitor.display_name, country.name) if country else visitor.display_name mail_channel_vals_list.append({ 'channel_partner_ids': [(4, operator.partner_id.id)], 'livechat_channel_id': visitor.website_id.channel_id.id,