From fc82e4feda822ec9d454ef5e143ce8002c4f6364 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Mon, 5 Jun 2023 10:51:06 +0000 Subject: [PATCH] [FIX] im_livechat: apply message update in real time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since [1], the `mail.record/insert` notification is not sent to the livechat visitor. Since [2], this notification is not listened by the notification handler either. This PR fixes those issues in order to make message update instantaneous on the public livechat. 1: https://github.com/odoo/odoo/pull/120018 2: https://github.com/odoo/odoo/pull/120893 task-3349454 closes odoo/odoo#123728 X-original-commit: 6f456e3b591ebc86502e4be65768042cc223c3db Signed-off-by: Alexandre Kühn (aku) Signed-off-by: Debondt Didier (did) --- addons/im_livechat/models/discuss_channel.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/im_livechat/models/discuss_channel.py b/addons/im_livechat/models/discuss_channel.py index d6adf7c5414..74f0fdad0c2 100644 --- a/addons/im_livechat/models/discuss_channel.py +++ b/addons/im_livechat/models/discuss_channel.py @@ -101,8 +101,8 @@ class DiscussChannel(models.Model): message_body = '
    %s
' % (''.join(html_links)) self._send_transient_message(self.env['res.partner'].browse(pid), message_body) - def _message_update_content_after_hook(self, message): - self.ensure_one() + def _message_update_content(self, message, body, attachment_ids=None, strict=True, **kwargs): + super()._message_update_content(message=message, body=body, attachment_ids=attachment_ids, strict=strict, **kwargs) if self.channel_type == 'livechat': self.env['bus.bus']._sendone(self.uuid, 'mail.record/insert', { 'Message': { @@ -110,7 +110,6 @@ class DiscussChannel(models.Model): 'body': message.body, } }) - return super()._message_update_content_after_hook(message=message) def _get_visitor_leave_message(self, operator=False, cancel=False): return _('Visitor has left the conversation.')