[FIX] mass_mailing: remove unsubscribe link from test mailing

When using the "Test Mailing" button, a sample mail was sent to a
particular mail address and a text-like unsubscribe link was added
below the mail body. This link was ugly, ununderstandable and useless
as it is test mailing anyway.

To add unsubscribe links to your mail body, use the footer blocks
which contain this kind of link (note: they are inserted by default
in all mail templates).
This commit is contained in:
qsm-odoo
2016-11-17 11:06:09 +01:00
parent e01837d2f4
commit 48d5420d7f
+1 -4
View File
@@ -26,15 +26,12 @@ class TestMassMailing(models.TransientModel):
'reply_to': mailing.reply_to,
'email_to': test_mail,
'subject': mailing.name,
'body_html': '',
'body_html': mailing.body_html,
'notification': True,
'mailing_id': mailing.id,
'attachment_ids': [(4, attachment.id) for attachment in mailing.attachment_ids],
}
mail = self.env['mail.mail'].create(mail_values)
unsubscribe_url = mail._get_unsubscribe_url(test_mail)
body = tools.append_content_to_html(mailing.body_html, unsubscribe_url, plaintext=False, container_tag='p')
mail.write({'body_html': body})
mails |= mail
mails.send()
return True