diff options
| author | David Beguin <dbe@odoo.com> | 2018-12-12 15:43:09 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-05-13 15:18:40 +0000 |
| commit | 5723ee1f21c6182494621a128204f988813fa408 (patch) | |
| tree | f1eb3f54e57ff4b9f99ce6da746de572fffecaa4 /addons/mail/wizard/mail_compose_message.py | |
| parent | 957c99abd53b42fa82903ad7ad03300797a706cf (diff) | |
[REF] mail, various : make message_get_default_recipients from mail.thread private
Purpose: make some methods from mail.thread mixin private and update their
naming if necessary. Some methods prepare data for business flows and deal
with internal information. Public methods should either use of give some
access to those methods. Computation itself should be keps internal.
In this commit we put message_get_default_recipients as private. Its API
is improved to clearly separate model-inherited method (overriden in some
addons) and general tool method given by the mixin. Finally all sudo hidden
in the computation are removed. Caller now give a sudo-ed record set in order
to be more explicit. Low level method just computes the result and does not
care about sudo-ing or ACLs.
Note a model approach for this method is necessary as mass mailing using
mail.template records does not ensure records to check inherit from mail
thread.
Some addons are updated accordingly to the method change.
Related to task ID 1911679
Linked to PR #29483
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index ba43532c81e..0fdc996a600 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -467,7 +467,7 @@ class MailComposer(models.TransientModel): template rendering represent a significant part of the process. Default recipients are also computed, based on mail_thread method - message_get_default_recipients. This allows to ensure a mass mailing has + _message_get_default_recipients. This allows to ensure a mass mailing has always some recipients specified. :param browse wizard: current mail.compose.message browse record @@ -488,7 +488,8 @@ class MailComposer(models.TransientModel): replies_to = self.env['mail.template']._render_template(self.reply_to, self.model, res_ids) default_recipients = {} if not self.partner_ids: - default_recipients = self.env['mail.thread'].message_get_default_recipients(res_model=self.model, res_ids=res_ids) + records = self.env[self.model].browse(res_ids).sudo() + default_recipients = self.env['mail.thread']._message_get_default_recipients_on_records(records) results = dict.fromkeys(res_ids, False) for res_id in res_ids: |
