Skip to content
Snippets Groups Projects
Commit a3ab33f2 authored by Goffin Simon's avatar Goffin Simon
Browse files

[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
parent 0fd06e59
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment