diff options
| author | std-odoo <std@odoo.com> | 2020-08-10 08:07:48 +0000 |
|---|---|---|
| committer | std-odoo <std@odoo.com> | 2020-08-18 08:47:28 +0000 |
| commit | 13d1f3e012d0c528dbea67ee5e1d4c32548195a3 (patch) | |
| tree | eb69f43e611d962243163b03dc48a06ce0885cb2 /addons/mass_mailing/models/mailing.py | |
| parent | 8d62eacfff5f94f692661c221c7b43f39bd3b891 (diff) | |
[IMP] mass_mailing: allow to customize the mail preview
Purpose
=======
Allow to customize the preview text in mass mailing.
Specifications
==============
We do not generate the preview text anymore, instead we add
a new field to let the user choose want he want to put into
the preview. As the preview is added in the mail body, it
supports dynamic placeholders.
Rename "View in browser" into "View Online" because the text
will be displayed in the preview if the snippet is added at
the beginning of the email. And we want to make it shorter.
Remove the alt attribute of the image tag which are not part
of the "email content" in the mass mailing template.
So, we improve the email preview in the mail clients
(otherwise the mail client include the alt attribute into the
preview).
Task-2313872
closes odoo/odoo#55695
Related: odoo/upgrade#1584
Related: odoo/enterprise#12323
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mass_mailing/models/mailing.py')
| -rw-r--r-- | addons/mass_mailing/models/mailing.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index d329cb2e572..1048a3da425 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -67,6 +67,11 @@ class MassMailing(models.Model): active = fields.Boolean(default=True, tracking=True) subject = fields.Char('Subject', help='Subject of your Mailing', required=True, translate=True) + preview = fields.Char( + 'Preview', translate=True, + help='Catchy preview sentence that encourages recipients to open this email.\n' + 'In most inboxes, this is displayed next to the subject.\n' + 'Keep it empty if you prefer the first characters of your email content to appear instead.') email_from = fields.Char(string='Send From', required=True, default=lambda self: self.env.user.email_formatted) sent_date = fields.Datetime(string='Sent Date', copy=False) @@ -569,7 +574,7 @@ class MassMailing(models.Model): composer_values = { 'author_id': author_id, 'attachment_ids': [(4, attachment.id) for attachment in mailing.attachment_ids], - 'body': self._prepend_preview(self.body_html), + 'body': self._prepend_preview(self.body_html, self.preview), 'subject': mailing.subject, 'model': mailing.mailing_model_real, 'email_from': mailing.email_from, |
