summaryrefslogtreecommitdiff
path: root/addons/mail/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2015-12-08 16:58:07 +0100
committerThibault Delavallée <tde@openerp.com>2015-12-09 09:59:03 +0100
commitb783e25a1d306a97676db35481663c17d5c8fd15 (patch)
treefea61f3fef2ce0ecdfcd3451468ee678600eddf8 /addons/mail/wizard/mail_compose_message.py
parent07425d407f9b017baaa85afa68aff0b798df5621 (diff)
[FIX] mail: template signature duplicated
When using a template adding the signature, do not re-add it when posting the message on a document. For example the Sale Order - Send by Email templates generated two signature in the email. This issue has been introduced when migrating mail to the new API.
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
-rw-r--r--addons/mail/wizard/mail_compose_message.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index cebd729d301..6ea72c16ed5 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -195,15 +195,10 @@ class MailComposer(models.TransientModel):
""" Process the wizard content and proceed with sending the related
email(s), rendering any template patterns on the fly if needed. """
for wizard in self:
- Mail = self.env['mail.mail']
# Duplicate attachments linked to the email.template.
# Indeed, basic mail.compose.message wizard duplicates attachments in mass
# mailing mode. But in 'single post' mode, attachments of an email template
# also have to be duplicated to avoid changing their ownership.
- 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)
if wizard.attachment_ids and wizard.composition_mode != 'mass_mail' and wizard.template_id:
new_attachment_ids = []
for attachment in wizard.attachment_ids:
@@ -215,7 +210,14 @@ class MailComposer(models.TransientModel):
# Mass Mailing
mass_mode = wizard.composition_mode in ('mass_mail', 'mass_post')
+
+ Mail = self.env['mail.mail']
ActiveModel = self.env[wizard.model if wizard.model else 'mail.thread']
+ 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)
if not hasattr(ActiveModel, 'message_post'):
ActiveModel = self.env['mail.thread'].with_context(thread_model=wizard.model)
if wizard.composition_mode == 'mass_post':