diff options
| author | Jairo Llopis <yajo.sk8@gmail.com> | 2019-05-08 08:20:18 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-10-02 12:57:32 +0000 |
| commit | 7d93c80693574cfd7baf9a2dc54283ac4ae8cb5b (patch) | |
| tree | 0aa7f4123409f46236075cd488bc1468d17ec964 /addons | |
| parent | 824f55f3add14c820d049a16b47c7b13b027eff3 (diff) | |
[IMP] mail: allow auto_commit parameter with templated message posts
The underlying `mail.compose.message` model has a useful `auto_commit`
argument when sending emails, which is unavailable when posting messages with
template through message_post_with_template.
This patch simply exposes the preexisting feature, to ease developments that
need it.
closes odoo/odoo#37783
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mail/models/mail_thread.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 91ebdb094b4..a1348504f27 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1923,7 +1923,7 @@ class MailThread(models.AbstractModel): kwargs['body'] = rendered_template record.message_post_with_template(False, **kwargs) - def message_post_with_template(self, template_id, email_layout_xmlid=None, **kwargs): + def message_post_with_template(self, template_id, email_layout_xmlid=None, auto_commit=False, **kwargs): """ Helper method to send a mail with a template :param template_id : the id of the template to render to create the body of the message :param **kwargs : parameter to create a mail.compose.message woaerd (which inherit from mail.message) @@ -1952,7 +1952,7 @@ class MailThread(models.AbstractModel): if template_id: update_values = composer.onchange_template_id(template_id, kwargs['composition_mode'], self._name, res_id)['value'] composer.write(update_values) - return composer.send_mail() + return composer.send_mail(auto_commit=auto_commit) def message_notify(self, partner_ids=False, parent_id=False, model=False, res_id=False, author_id=None, email_from=None, body='', subject=False, **kwargs): |
