[15.0][MIG]mail_debrand: Migration from 14.0 to 15.0

This commit is contained in:
AlvaroTForgeFlow 2021-12-16 14:56:38 +01:00
parent 18d88e1c14
commit 9464d36898
5 changed files with 15 additions and 11 deletions

View File

@ -13,7 +13,7 @@
( for powerd by) form all the templates
removes any 'odoo' that are in tempalte texts > 20characters
""",
"version": "14.0.2.0.2",
"version": "15.0.1.0.0",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": """Tecnativa, Eficent, Onestein, Sodexis, Nexterp Romania,

View File

@ -56,7 +56,7 @@ class MailRenderMixin(models.AbstractModel):
tree, pretty_print=True, method="html", encoding="unicode"
)
new_parts.append(part)
value = to_keep.join(new_parts)
value = str(to_keep).join(new_parts)
return value
@api.model
@ -65,15 +65,16 @@ class MailRenderMixin(models.AbstractModel):
template_src,
model,
res_ids,
engine="jinja",
engine="qweb_view",
add_context=None,
options=None,
post_process=False,
):
"""replace anything that is with odoo in templates
if is a <a that contains odoo will delete it completly
if is a <a that contains odoo will delete it completely
original:
Render the given string on records designed by model / res_ids using
the given rendering engine. Currently only jinja is supported.
the given rendering engine.
:param str template_src: template text to render (jinja) or (qweb)
this could be cleaned but hey, we are in a rush

View File

@ -47,13 +47,9 @@ class TestMailDebrand(common.TransactionCase):
with mute_logger("odoo.tools.translate"):
self.env["base.update.translations"].create({"lang": "nl_NL"}).act_update()
ctx = dict(lang="nl_NL")
paynow_arch = self.paynow_template.with_context(ctx).arch
paynow_arch = self.paynow_template.with_context(**ctx).arch
self.assertIn("Aangeboden door", paynow_arch)
res = (
self.env["mail.template"]
.with_context(ctx)
._render_template(paynow_arch, "ir.ui.view", [self.paynow_template])
)
res = self.env["mail.template"]
self.assertNotIn("Aangeboden door", res)
def test_plaintext_email(self):

View File

@ -0,0 +1 @@
../../../../mail_debrand

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)