Files
odoo_source/addons/mass_mailing/models/mail_template.py
T
Jeremy Kersten c2d83973ea [FIX] mass_mailing: don't short url before rendering
Before this commit, if you generate the href with jinja/mako syntax,
the un-rendered url will be shortened.

So:
    href="https://www.odoo.com?id=${object.id}"
will become:
    href="https://www.odoo.com/r/asw"

where
   https://www.odoo.com/r/asw
redirect to
   https://www.odoo.com?id=${object.id}
instead of
   https://www.odoo.com?id=1

Adaptation of #28540 for 11.0 version.

opw-1903803
closes #29083
2018-11-28 10:21:11 +00:00

23 lines
688 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class MailTemplate(models.Model):
_inherit = "mail.template"
@api.model
def render_post_process(self, html):
# super will transform relative url to absolute
html = super(MailTemplate, self).render_post_process(html)
# apply shortener after
if self.env.context.get('post_convert_links'):
html = self.env['link.tracker'].convert_links(
html,
self.env.context['post_convert_links'],
blacklist=['/unsubscribe_from_list']
)
return html