[16.0][MIG] mail_debrand

pull/1021/head
Logeshkumar 2022-12-05 10:53:08 +05:30
parent c50e3146a4
commit 2b8c9e5e44
5 changed files with 18 additions and 29 deletions

View File

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

View File

@ -1,18 +1,16 @@
# Copyright 2017 Tecnativa - Pedro M. Baeza
# Copyright 2020 Onestein - Andrea Stirpe
# Copyright 2021 Sodexis
# Copyright 2021-22 Sodexis
# Copyright 2021 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.tools.misc import mute_logger
class TestMailDebrand(common.TransactionCase):
def setUp(self):
super().setUp()
self.default_template = self.env.ref("mail.message_notification_email")
self.paynow_template = self.env.ref("mail.mail_notification_paynow")
self.default_template = self.env.ref("mail.mail_notification_layout")
def test_debrand_binary_value(self):
"""
@ -26,32 +24,16 @@ class TestMailDebrand(common.TransactionCase):
self.fail("Debranding binary string raised TypeError")
def test_default_debrand(self):
self.assertIn("using", self.default_template.arch)
res = self.env["mail.template"]._render_template(
self.default_template.arch, "ir.ui.view", [self.default_template]
)
self.assertNotIn("using", res)
def test_paynow_debrand(self):
self.assertIn("Powered by", self.paynow_template.arch)
res = self.env["mail.template"]._render_template(
self.paynow_template.arch, "ir.ui.view", [self.paynow_template]
self.assertIn("Powered by", self.default_template.arch)
model = "mail.template"
res_ids = self.env[model].search([], limit=1).ids
res = self.env[model]._render_template(
self.default_template,
"ir.ui.view",
res_ids,
)
self.assertNotIn("Powered by", res)
def test_lang_paynow_debrand(self):
with mute_logger("odoo.addons.base.models.ir_translation"):
self.env["base.language.install"].create(
{"lang": "nl_NL", "overwrite": True}
).lang_install()
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
self.assertIn("Aangeboden door", paynow_arch)
res = self.env["mail.template"]
self.assertNotIn("Aangeboden door", res)
def test_plaintext_email(self):
MailMessage = self.env["mail.mail"]
email_values = {

View File

@ -1,6 +1,6 @@
# Copyright 2017 Tecnativa - Pedro M. Baeza
# Copyright 2020 Onestein - Andrea Stirpe
# Copyright 2021 Sodexis
# Copyright 2021-22 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime

View File

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

View File

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