diff options
| author | Thibault Delavallée <tde@openerp.com> | 2016-01-12 17:12:22 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2016-01-13 10:34:09 +0100 |
| commit | 2bfb880503ba9f0177747aea3da38b8bbeccbe02 (patch) | |
| tree | d35d6caca874e100bc8a929d4bc1d2287c3bad88 /addons/mail/wizard/mail_compose_message.py | |
| parent | bc5e51d6b056a952a59cb8599a9d0aa6b98689d2 (diff) | |
[FIX] mail: auto delete
Correctly set the auto delete property coming from the template in the composer.
Set the mail_auto_delete context key for message_post, and directly set the
auto_delete field value in mass mailing mode.
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 6ea72c16ed5..59a1f6cac08 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -216,8 +216,8 @@ class MailComposer(models.TransientModel): if wizard.template_id: # template user_signature is added when generating body_html # mass mailing: use template auto_delete value -> note, for emails mass mailing only - Mail = Mail.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete, mail_server_id=wizard.template_id.mail_server_id.id) - ActiveModel = ActiveModel.with_context(mail_notify_user_signature=False) + Mail = Mail.with_context(mail_notify_user_signature=False, mail_server_id=wizard.template_id.mail_server_id.id) + ActiveModel = ActiveModel.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete) if not hasattr(ActiveModel, 'message_post'): ActiveModel = self.env['mail.thread'].with_context(thread_model=wizard.model) if wizard.composition_mode == 'mass_post': @@ -288,8 +288,8 @@ class MailComposer(models.TransientModel): # always keep a copy, reset record name (avoid browsing records) mail_values.update(notification=True, model=self.model, res_id=res_id, record_name=False) # auto deletion of mail_mail - if 'mail_auto_delete' in self._context: - mail_values['auto_delete'] = self._context.get('mail_auto_delete') + if self.template_id and self.template_id.auto_delete: + mail_values['auto_delete'] = True # rendered values using template email_dict = rendered_values[res_id] mail_values['partner_ids'] += email_dict.pop('partner_ids', []) |
