[FIX] website,website_livechat : restore chat request feature

since e33172e832,
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
This commit is contained in:
David Beguin
2019-09-17 14:12:22 +00:00
parent 858a92d2f2
commit e6b5aae210
@@ -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