diff options
| author | XavierDo <xdo@odoo.com> | 2019-04-12 11:43:36 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-05-29 13:32:26 +0000 |
| commit | 6f43977a4e2837cc8a2b47f3cab086f334c20978 (patch) | |
| tree | 400bc1f39cb25640808b514638693b3153732aad /addons/mail_bot/models/mail_bot.py | |
| parent | c9d173a3e7645eef388a927466d564889d304cb6 (diff) | |
[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
Diffstat (limited to 'addons/mail_bot/models/mail_bot.py')
| -rw-r--r-- | addons/mail_bot/models/mail_bot.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail_bot/models/mail_bot.py b/addons/mail_bot/models/mail_bot.py index 96a7a1988dc..2e0ab860255 100644 --- a/addons/mail_bot/models/mail_bot.py +++ b/addons/mail_bot/models/mail_bot.py @@ -214,7 +214,7 @@ class MailBot(models.AbstractModel): def _is_bot_pinged(self, values): odoobot_id = self.env['ir.model.data'].xmlid_to_res_id("base.partner_root") - return (4, odoobot_id) in values.get('partner_ids', []) + return odoobot_id in values.get('partner_ids', []) def _is_bot_in_private_channel(self, record): odoobot_id = self.env['ir.model.data'].xmlid_to_res_id("base.partner_root") |
