summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/models/mail_render_mixin.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/mass_mailing/models/mail_render_mixin.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/mass_mailing/models/mail_render_mixin.py')
-rw-r--r--addons/mass_mailing/models/mail_render_mixin.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/mass_mailing/models/mail_render_mixin.py b/addons/mass_mailing/models/mail_render_mixin.py
new file mode 100644
index 00000000..133643f2
--- /dev/null
+++ b/addons/mass_mailing/models/mail_render_mixin.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, models
+
+
+class MailRenderMixin(models.AbstractModel):
+ _inherit = "mail.render.mixin"
+
+ @api.model
+ def _render_template_postprocess(self, rendered):
+ # super will transform relative url to absolute
+ rendered = super(MailRenderMixin, self)._render_template_postprocess(rendered)
+
+ # apply shortener after
+ if self.env.context.get('post_convert_links'):
+ for res_id, html in rendered.items():
+ rendered[res_id] = self._shorten_links(
+ html,
+ self.env.context['post_convert_links'],
+ blacklist=['/unsubscribe_from_list', '/view']
+ )
+ return rendered