diff options
| author | Goffin Simon <sig@odoo.com> | 2018-05-24 09:46:36 +0200 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2018-05-24 09:46:36 +0200 |
| commit | a3ab33f2121c487920d370675d0e1a32dfc96c65 (patch) | |
| tree | 61a1b4ac86cfd403d1ec6eb5e0e52419dd30f5c4 /addons/mass_mailing/models/mail_mail.py | |
| parent | 0fd06e59482cb3921002679c97bce9d42e09409f (diff) | |
[FIX] mass_mailing: unsubscribe not working in multi lang
When installing the website with a lang different than the one set
on the user, the button unsubscribe in the mass mailing snippets
didn't work because the unsubscribe link contains the code of the
language. The function send_get_email_dict in model mail.mail didn't
expect this behavior and so couldn't set the right unsubscribe link
in the mail.
opw:1850696
Diffstat (limited to 'addons/mass_mailing/models/mail_mail.py')
| -rw-r--r-- | addons/mass_mailing/models/mail_mail.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mass_mailing/models/mail_mail.py b/addons/mass_mailing/models/mail_mail.py index f4611a3250c..f7ef42ff223 100644 --- a/addons/mass_mailing/models/mail_mail.py +++ b/addons/mass_mailing/models/mail_mail.py @@ -99,9 +99,9 @@ class MailMail(osv.Model): emails = tools.email_split(res.get('email_to')[0]) email_to = emails and emails[0] or False unsubscribe_url= self._get_unsubscribe_url(cr, uid, mail, email_to, context=context) - link_to_replace = base_url+'/unsubscribe_from_list' + regex_link_to_replace = re.escape(base_url) + '(/[a-z]{2}_[A-Z]{2})?' + '/unsubscribe_from_list' if link_to_replace in res['body']: - res['body'] = res['body'].replace(link_to_replace, unsubscribe_url if unsubscribe_url else '#') + res['body'] = res['body'].replace(regex_link_to_replace, unsubscribe_url if unsubscribe_url else '#') return res def _postprocess_sent_message(self, cr, uid, mail, context=None, mail_sent=True): |
