summaryrefslogtreecommitdiff
path: root/addons/website_livechat/models
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-09-17 09:33:48 +0000
committerDavid Beguin <dbe@odoo.com>2019-09-17 14:12:22 +0000
commite6b5aae21073686c7ce7c423ca19861f696f8f45 (patch)
treead24bc143a4d7b38432c0d4b0db3c0b5be4b1ff2 /addons/website_livechat/models
parent858a92d2f2431125a75400c2bf11596dd76b7180 (diff)
[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
Diffstat (limited to 'addons/website_livechat/models')
-rw-r--r--addons/website_livechat/models/mail_channel.py5
1 files 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