From 6f43977a4e2837cc8a2b47f3cab086f334c20978 Mon Sep 17 00:00:00 2001 From: XavierDo Date: Fri, 12 Apr 2019 11:43:36 +0000 Subject: [REF] mail: improve message_post and message_notify API Message post should always be called on a record (ensure_one). That way we ensure posting a message is always done in a record's context with right values computed (reply_to, followers, ...) Message_notify can be called on record or on mail_thread and must have partner_ids. It is based on the recently modified user_notification mechanism and allow to notify a partner on a record or just to push him a message (aka, not linked to a record). Small performance improvement * browse recipients instead of search in _notify_email_recipients; * todo in future optimizations: mayybe be improve by searching on ids and is_blacklist immediately; Related to task 1943901 Linked to PR #32404 --- addons/mail_bot/models/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/mail_bot/models/mail_thread.py') diff --git a/addons/mail_bot/models/mail_thread.py b/addons/mail_bot/models/mail_thread.py index 9a5e2e05a99..e1be43e7ca2 100644 --- a/addons/mail_bot/models/mail_thread.py +++ b/addons/mail_bot/models/mail_thread.py @@ -7,6 +7,6 @@ from odoo import models class MailThread(models.AbstractModel): _inherit = 'mail.thread' - def _message_post_after_hook(self, message, msg_vals, model_description, mail_auto_delete): + def _message_post_after_hook(self, message, msg_vals): self.env['mail.bot']._apply_logic(self, msg_vals) - return super(MailThread, self)._message_post_after_hook(message, msg_vals, model_description, mail_auto_delete) + return super(MailThread, self)._message_post_after_hook(message, msg_vals) -- cgit v1.2.3