From e6b5aae21073686c7ce7c423ca19861f696f8f45 Mon Sep 17 00:00:00 2001 From: David Beguin Date: Tue, 17 Sep 2019 09:33:48 +0000 Subject: [PATCH] [FIX] website,website_livechat : restore chat request feature since e33172e83210a5e0044a6fb92e315b84deefc440, a chat request could not be sent to a visitor as the website was not set anymore on the visitor and the mail_channel could then not be assigned to a livechat_channel (using the website_id). This commit restore the feature using the new temporary model website.visitor.lastconnection. Task ID: 2056080 PR #36290 --- addons/website_livechat/models/mail_channel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/website_livechat/models/mail_channel.py b/addons/website_livechat/models/mail_channel.py index 795fe9bc2d6..48d6d08a847 100644 --- a/addons/website_livechat/models/mail_channel.py +++ b/addons/website_livechat/models/mail_channel.py @@ -84,7 +84,8 @@ class MailChannel(models.Model): message_author_id = message.author_id visitor = self.livechat_visitor_id if len(self) == 1 and visitor and message_author_id != self.livechat_operator_id: - visitor.sudo().write({ - 'last_connection_datetime': fields.datetime.now(), + self.env['website.visitor.lastconnection'].create({ + 'visitor_id': visitor.id, + 'connection_datetime': fields.datetime.now() }) return message