We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[14.0] mail_debrand empty content for sign up
Using mail_debrand, the content of the mail sent at sign up is empty (headers and footer are properly filled) :
```html
    <!-- CONTENT -->
    <tr>
        <td align="center" style="min-width: 590px;">
            <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                <tr><td valign="top" style="font-size: 13px;">
                    </td></tr>
                <tr><td style="text-align:center;">
                  <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;">
                </td></tr>
            </table>
        </td>
    </tr>
```

Without mail_debrand module installed I get the following content : 
```html
    <!-- CONTENT -->
    <tr>
        <td align="center" style="min-width: 590px;">
            <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                <tr><td valign="top" style="font-size: 13px;">
                    <div>
                        Cher(e) test,<br/><br/>
                        Vous avez été invité par Admin LE FILAMENT à rejoindre Odoo.
                        <div style="margin: 16px 0px 16px 0px;">
                            <a href="removed_url" style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
                                Accepter l'invitation
                            </a>
                        </div>
                        Votre nom de domaine Odoo est: <b><a href="removed_url">removed_url</a></b><br/>
                        Votre courriel de connection est: <b><a href="removed_url" target="_blank">removed_email</a></b><br/><br/>
                        Jamais entendu parler d'Odoo? C’est un logiciel de gestion tout-en-un apprécié par plus de 3 millions d’utilisateurs. Il améliorera considérablement votre expérience de travail et augmentera votre productivité.
                        <br/><br/>
                        Faites un tour dans la section <a href="https://www.odoo.com/page/tour?utm_source=db&amp;utm_medium=auth" style="color: #875A7B;">Odoo Tour</a> afin de découvrir l'outil.
                        <br/><br/>
                        Enjoy Odoo!<br/>
                        --<br/>L'équipe LE FILAMENT 
                    </div>
                </td></tr>
                <tr><td style="text-align:center;">
                  <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
                </td></tr>
            </table>
        </td>
    </tr>
```

The issue seems related to this block : https://github.com/OCA/social/blob/02467d14fa4b2ade959ced981f3a0411d46e1d26/mail_debrand/models/mail_render_mixin.py#L51-L52 where the full div is removed because of Odoo tour section.

I am not sure how to address this without breaking the way this module works for other mail templates, any idea would be welcome !

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mail_debrand/__manifest__.py`
Content:
```
1 # Copyright 2016 Tecnativa - Jairo Llopis
2 # Copyright 2017 Tecnativa - Pedro M. Baeza
3 # Copyright 2019 ForgeFlow S.L. - Lois Rilo <lois.rilo@forgeflow.com>
4 # 2020 NextERP Romania
5 # Copyright 2021 Tecnativa - João Marques
6 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
7 
8 {
9     "name": "Mail Debrand",
10     "summary": """Remove Odoo branding in sent emails
11     Removes anchor <a href odoo.com togheder with it's parent
12     ( for powerd by) form all the templates
13     removes any 'odoo' that are in tempalte texts > 20characters
14     """,
15     "version": "14.0.2.2.1",
16     "category": "Social Network",
17     "website": "https://github.com/OCA/social",
18     "author": """Tecnativa, ForgeFlow, Onestein, Sodexis, Nexterp Romania,
19              Odoo Community Association (OCA)""",
20     "license": "AGPL-3",
21     "installable": True,
22     "depends": ["mail"],
23     "development_status": "Production/Stable",
24     "maintainers": ["pedrobaeza", "joao-p-marques"],
25 }
26
```

Path: `mail_debrand/models/mail_render_mixin.py`
Content:
```
1 # Copyright 2019 O4SB - Graeme Gellatly
2 # Copyright 2019 Tecnativa - Ernesto Tejeda
3 # Copyright 2020 Onestein - Andrea Stirpe
4 # Copyright 2021 Tecnativa - João Marques
5 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6 import re
7 
8 from lxml import etree, html
9 
10 from odoo import api, models
11 
12 
13 class MailRenderMixin(models.AbstractModel):
14     _inherit = "mail.render.mixin"
15 
16     def remove_href_odoo(
17         self, value, remove_parent=True, remove_before=False, to_keep=None
18     ):
19         if len(value) < 20:
20             return value
21         # value can be bytes type; ensure we get a proper string
22         if type(value) is bytes:
23             value = value.decode()
24         has_odoo_link = re.search(r"<a\s(.*)odoo\.com", value, flags=re.IGNORECASE)
25         if has_odoo_link:
26             # We don't want to change what was explicitly added in the message body,
27             # so we will only change what is before and after it.
28             if to_keep:
29                 value = value.replace(to_keep, "<body_msg></body_msg>")
30             tree = html.fromstring(value)
31             odoo_anchors = tree.xpath('//a[contains(@href,"odoo.com")]')
32             for elem in odoo_anchors:
33                 parent = elem.getparent()
34                 previous = elem.getprevious()
35                 if remove_before and not remove_parent and previous is not None:
36                     # remove 'using' that is before <a and after </span>
37                     previous.tail = ""
38                 if remove_parent and len(parent.getparent()):
39                     # anchor <a href odoo has a parent powered by that must be removed
40                     parent.getparent().remove(parent)
41                 else:
42                     if parent.tag == "td":  # also here can be powered by
43                         parent.getparent().remove(parent)
44                     else:
45                         parent.remove(elem)
46             value = etree.tostring(
47                 tree, pretty_print=True, method="html", encoding="unicode"
48             )
49             if to_keep:
50                 value = value.replace("<body_msg></body_msg>", to_keep)
51         return value
52 
53     @api.model
54     def _render_template(
55         self,
56         template_src,
57         model,
58         res_ids,
59         engine="jinja",
60         add_context=None,
61         post_process=False,
62     ):
63         """replace anything that is with odoo in templates
64         if is a <a that contains odoo will delete it completly
65         original:
66          Render the given string on records designed by model / res_ids using
67         the given rendering engine. Currently only jinja is supported.
68 
69         :param str template_src: template text to render (jinja) or  (qweb)
70           this could be cleaned but hey, we are in a rush
71         :param str model: model name of records on which we want to perform rendering
72         :param list res_ids: list of ids of records (all belonging to same model)
73         :param string engine: jinja
74         :param post_process: perform rendered str / html post processing (see
75           ``_render_template_postprocess``)
76 
77         :return dict: {res_id: string of rendered template based on record}"""
78         orginal_rendered = super()._render_template(
79             template_src,
80             model,
81             res_ids,
82             engine=engine,
83             add_context=add_context,
84             post_process=post_process,
85         )
86 
87         for key in res_ids:
88             orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key])
89 
90         return orginal_rendered
91 
92     def _replace_local_links(self, html, base_url=None):
93         message = super()._replace_local_links(html)
94         message = re.sub(
95             r"""(Powered by\s(.*)Odoo</a>)""", "<div>&nbsp;</div>", message
96         )
97         return message
98
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mail_debrand/__manifest__.py b/mail_debrand/__manifest__.py
--- a/mail_debrand/__manifest__.py
+++ b/mail_debrand/__manifest__.py
@@ -20,6 +20,9 @@
     "license": "AGPL-3",
     "installable": True,
     "depends": ["mail"],
+    "data": [
+        "data/ir_config_parameter.xml",
+    ],
     "development_status": "Production/Stable",
     "maintainers": ["pedrobaeza", "joao-p-marques"],
 }
diff --git a/mail_debrand/models/mail_render_mixin.py b/mail_debrand/models/mail_render_mixin.py
--- a/mail_debrand/models/mail_render_mixin.py
+++ b/mail_debrand/models/mail_render_mixin.py
@@ -22,6 +22,23 @@
         if type(value) is bytes:
             value = value.decode()
         has_odoo_link = re.search(r"<a\s(.*)odoo\.com", value, flags=re.IGNORECASE)
+        extra_regex_to_skip = (
+            self.env["ir.config_parameter"]
+            .sudo()
+            .get_param("mail_debrand.extra_regex_to_skip", "False")
+        )
+        # value is required field on ir config_parameter, so we have added
+        # safety check for "False"
+        if (
+            has_odoo_link
+            and extra_regex_to_skip
+            and extra_regex_to_skip.strip().lower() != "false"
+        ):
+            # check each regex to be skipped
+            for regex in extra_regex_to_skip.split(","):
+                if re.search(r"{}".format(regex), value, flags=re.IGNORECASE):
+                    has_odoo_link = False
+                    break
         if has_odoo_link:
             # We don't want to change what was explicitly added in the message body,
             # so we will only change what is before and after it.

{"golden_diff": "diff --git a/mail_debrand/__manifest__.py b/mail_debrand/__manifest__.py\n--- a/mail_debrand/__manifest__.py\n+++ b/mail_debrand/__manifest__.py\n@@ -20,6 +20,9 @@\n     \"license\": \"AGPL-3\",\n     \"installable\": True,\n     \"depends\": [\"mail\"],\n+    \"data\": [\n+        \"data/ir_config_parameter.xml\",\n+    ],\n     \"development_status\": \"Production/Stable\",\n     \"maintainers\": [\"pedrobaeza\", \"joao-p-marques\"],\n }\ndiff --git a/mail_debrand/models/mail_render_mixin.py b/mail_debrand/models/mail_render_mixin.py\n--- a/mail_debrand/models/mail_render_mixin.py\n+++ b/mail_debrand/models/mail_render_mixin.py\n@@ -22,6 +22,23 @@\n         if type(value) is bytes:\n             value = value.decode()\n         has_odoo_link = re.search(r\"<a\\s(.*)odoo\\.com\", value, flags=re.IGNORECASE)\n+        extra_regex_to_skip = (\n+            self.env[\"ir.config_parameter\"]\n+            .sudo()\n+            .get_param(\"mail_debrand.extra_regex_to_skip\", \"False\")\n+        )\n+        # value is required field on ir config_parameter, so we have added\n+        # safety check for \"False\"\n+        if (\n+            has_odoo_link\n+            and extra_regex_to_skip\n+            and extra_regex_to_skip.strip().lower() != \"false\"\n+        ):\n+            # check each regex to be skipped\n+            for regex in extra_regex_to_skip.split(\",\"):\n+                if re.search(r\"{}\".format(regex), value, flags=re.IGNORECASE):\n+                    has_odoo_link = False\n+                    break\n         if has_odoo_link:\n             # We don't want to change what was explicitly added in the message body,\n             # so we will only change what is before and after it.\n", "issue": "[14.0] mail_debrand empty content for sign up\nUsing mail_debrand, the content of the mail sent at sign up is empty (headers and footer are properly filled) :\r\n```html\r\n    <!-- CONTENT -->\r\n    <tr>\r\n        <td align=\"center\" style=\"min-width: 590px;\">\r\n            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"590\" style=\"min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;\">\r\n                <tr><td valign=\"top\" style=\"font-size: 13px;\">\r\n                    </td></tr>\r\n                <tr><td style=\"text-align:center;\">\r\n                  <hr width=\"100%\" style=\"background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;\">\r\n                </td></tr>\r\n            </table>\r\n        </td>\r\n    </tr>\r\n```\r\n\r\nWithout mail_debrand module installed I get the following content : \r\n```html\r\n    <!-- CONTENT -->\r\n    <tr>\r\n        <td align=\"center\" style=\"min-width: 590px;\">\r\n            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"590\" style=\"min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;\">\r\n                <tr><td valign=\"top\" style=\"font-size: 13px;\">\r\n                    <div>\r\n                        Cher(e) test,<br/><br/>\r\n                        Vous avez \u00e9t\u00e9 invit\u00e9 par Admin LE FILAMENT \u00e0 rejoindre Odoo.\r\n                        <div style=\"margin: 16px 0px 16px 0px;\">\r\n                            <a href=\"removed_url\" style=\"background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;\">\r\n                                Accepter l'invitation\r\n                            </a>\r\n                        </div>\r\n                        Votre nom de domaine Odoo est: <b><a href=\"removed_url\">removed_url</a></b><br/>\r\n                        Votre courriel de connection est: <b><a href=\"removed_url\" target=\"_blank\">removed_email</a></b><br/><br/>\r\n                        Jamais entendu parler d'Odoo? C\u2019est un logiciel de gestion tout-en-un appr\u00e9ci\u00e9 par plus de 3 millions d\u2019utilisateurs. Il am\u00e9liorera consid\u00e9rablement votre exp\u00e9rience de travail et augmentera votre productivit\u00e9.\r\n                        <br/><br/>\r\n                        Faites un tour dans la section <a href=\"https://www.odoo.com/page/tour?utm_source=db&amp;utm_medium=auth\" style=\"color: #875A7B;\">Odoo Tour</a> afin de d\u00e9couvrir l'outil.\r\n                        <br/><br/>\r\n                        Enjoy Odoo!<br/>\r\n                        --<br/>L'\u00e9quipe LE FILAMENT \r\n                    </div>\r\n                </td></tr>\r\n                <tr><td style=\"text-align:center;\">\r\n                  <hr width=\"100%\" style=\"background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;\"/>\r\n                </td></tr>\r\n            </table>\r\n        </td>\r\n    </tr>\r\n```\r\n\r\nThe issue seems related to this block : https://github.com/OCA/social/blob/02467d14fa4b2ade959ced981f3a0411d46e1d26/mail_debrand/models/mail_render_mixin.py#L51-L52 where the full div is removed because of Odoo tour section.\r\n\r\nI am not sure how to address this without breaking the way this module works for other mail templates, any idea would be welcome !\n", "before_files": [{"content": "# Copyright 2016 Tecnativa - Jairo Llopis\n# Copyright 2017 Tecnativa - Pedro M. Baeza\n# Copyright 2019 ForgeFlow S.L. - Lois Rilo <lois.rilo@forgeflow.com>\n# 2020 NextERP Romania\n# Copyright 2021 Tecnativa - Jo\u00e3o Marques\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\n{\n    \"name\": \"Mail Debrand\",\n    \"summary\": \"\"\"Remove Odoo branding in sent emails\n    Removes anchor <a href odoo.com togheder with it's parent\n    ( for powerd by) form all the templates\n    removes any 'odoo' that are in tempalte texts > 20characters\n    \"\"\",\n    \"version\": \"14.0.2.2.1\",\n    \"category\": \"Social Network\",\n    \"website\": \"https://github.com/OCA/social\",\n    \"author\": \"\"\"Tecnativa, ForgeFlow, Onestein, Sodexis, Nexterp Romania,\n             Odoo Community Association (OCA)\"\"\",\n    \"license\": \"AGPL-3\",\n    \"installable\": True,\n    \"depends\": [\"mail\"],\n    \"development_status\": \"Production/Stable\",\n    \"maintainers\": [\"pedrobaeza\", \"joao-p-marques\"],\n}\n", "path": "mail_debrand/__manifest__.py"}, {"content": "# Copyright 2019 O4SB - Graeme Gellatly\n# Copyright 2019 Tecnativa - Ernesto Tejeda\n# Copyright 2020 Onestein - Andrea Stirpe\n# Copyright 2021 Tecnativa - Jo\u00e3o Marques\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\nimport re\n\nfrom lxml import etree, html\n\nfrom odoo import api, models\n\n\nclass MailRenderMixin(models.AbstractModel):\n    _inherit = \"mail.render.mixin\"\n\n    def remove_href_odoo(\n        self, value, remove_parent=True, remove_before=False, to_keep=None\n    ):\n        if len(value) < 20:\n            return value\n        # value can be bytes type; ensure we get a proper string\n        if type(value) is bytes:\n            value = value.decode()\n        has_odoo_link = re.search(r\"<a\\s(.*)odoo\\.com\", value, flags=re.IGNORECASE)\n        if has_odoo_link:\n            # We don't want to change what was explicitly added in the message body,\n            # so we will only change what is before and after it.\n            if to_keep:\n                value = value.replace(to_keep, \"<body_msg></body_msg>\")\n            tree = html.fromstring(value)\n            odoo_anchors = tree.xpath('//a[contains(@href,\"odoo.com\")]')\n            for elem in odoo_anchors:\n                parent = elem.getparent()\n                previous = elem.getprevious()\n                if remove_before and not remove_parent and previous is not None:\n                    # remove 'using' that is before <a and after </span>\n                    previous.tail = \"\"\n                if remove_parent and len(parent.getparent()):\n                    # anchor <a href odoo has a parent powered by that must be removed\n                    parent.getparent().remove(parent)\n                else:\n                    if parent.tag == \"td\":  # also here can be powered by\n                        parent.getparent().remove(parent)\n                    else:\n                        parent.remove(elem)\n            value = etree.tostring(\n                tree, pretty_print=True, method=\"html\", encoding=\"unicode\"\n            )\n            if to_keep:\n                value = value.replace(\"<body_msg></body_msg>\", to_keep)\n        return value\n\n    @api.model\n    def _render_template(\n        self,\n        template_src,\n        model,\n        res_ids,\n        engine=\"jinja\",\n        add_context=None,\n        post_process=False,\n    ):\n        \"\"\"replace anything that is with odoo in templates\n        if is a <a that contains odoo will delete it completly\n        original:\n         Render the given string on records designed by model / res_ids using\n        the given rendering engine. Currently only jinja is supported.\n\n        :param str template_src: template text to render (jinja) or  (qweb)\n          this could be cleaned but hey, we are in a rush\n        :param str model: model name of records on which we want to perform rendering\n        :param list res_ids: list of ids of records (all belonging to same model)\n        :param string engine: jinja\n        :param post_process: perform rendered str / html post processing (see\n          ``_render_template_postprocess``)\n\n        :return dict: {res_id: string of rendered template based on record}\"\"\"\n        orginal_rendered = super()._render_template(\n            template_src,\n            model,\n            res_ids,\n            engine=engine,\n            add_context=add_context,\n            post_process=post_process,\n        )\n\n        for key in res_ids:\n            orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key])\n\n        return orginal_rendered\n\n    def _replace_local_links(self, html, base_url=None):\n        message = super()._replace_local_links(html)\n        message = re.sub(\n            r\"\"\"(Powered by\\s(.*)Odoo</a>)\"\"\", \"<div>&nbsp;</div>\", message\n        )\n        return message\n", "path": "mail_debrand/models/mail_render_mixin.py"}], "after_files": [{"content": "# Copyright 2016 Tecnativa - Jairo Llopis\n# Copyright 2017 Tecnativa - Pedro M. Baeza\n# Copyright 2019 ForgeFlow S.L. - Lois Rilo <lois.rilo@forgeflow.com>\n# 2020 NextERP Romania\n# Copyright 2021 Tecnativa - Jo\u00e3o Marques\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\n{\n    \"name\": \"Mail Debrand\",\n    \"summary\": \"\"\"Remove Odoo branding in sent emails\n    Removes anchor <a href odoo.com togheder with it's parent\n    ( for powerd by) form all the templates\n    removes any 'odoo' that are in tempalte texts > 20characters\n    \"\"\",\n    \"version\": \"14.0.2.2.1\",\n    \"category\": \"Social Network\",\n    \"website\": \"https://github.com/OCA/social\",\n    \"author\": \"\"\"Tecnativa, ForgeFlow, Onestein, Sodexis, Nexterp Romania,\n             Odoo Community Association (OCA)\"\"\",\n    \"license\": \"AGPL-3\",\n    \"installable\": True,\n    \"depends\": [\"mail\"],\n    \"data\": [\n        \"data/ir_config_parameter.xml\",\n    ],\n    \"development_status\": \"Production/Stable\",\n    \"maintainers\": [\"pedrobaeza\", \"joao-p-marques\"],\n}\n", "path": "mail_debrand/__manifest__.py"}, {"content": "# Copyright 2019 O4SB - Graeme Gellatly\n# Copyright 2019 Tecnativa - Ernesto Tejeda\n# Copyright 2020 Onestein - Andrea Stirpe\n# Copyright 2021 Tecnativa - Jo\u00e3o Marques\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\nimport re\n\nfrom lxml import etree, html\n\nfrom odoo import api, models\n\n\nclass MailRenderMixin(models.AbstractModel):\n    _inherit = \"mail.render.mixin\"\n\n    def remove_href_odoo(\n        self, value, remove_parent=True, remove_before=False, to_keep=None\n    ):\n        if len(value) < 20:\n            return value\n        # value can be bytes type; ensure we get a proper string\n        if type(value) is bytes:\n            value = value.decode()\n        has_odoo_link = re.search(r\"<a\\s(.*)odoo\\.com\", value, flags=re.IGNORECASE)\n        extra_regex_to_skip = (\n            self.env[\"ir.config_parameter\"]\n            .sudo()\n            .get_param(\"mail_debrand.extra_regex_to_skip\", \"False\")\n        )\n        # value is required field on ir config_parameter, so we have added\n        # safety check for \"False\"\n        if (\n            has_odoo_link\n            and extra_regex_to_skip\n            and extra_regex_to_skip.strip().lower() != \"false\"\n        ):\n            # check each regex to be skipped\n            for regex in extra_regex_to_skip.split(\",\"):\n                if re.search(r\"{}\".format(regex), value, flags=re.IGNORECASE):\n                    has_odoo_link = False\n                    break\n        if has_odoo_link:\n            # We don't want to change what was explicitly added in the message body,\n            # so we will only change what is before and after it.\n            if to_keep:\n                value = value.replace(to_keep, \"<body_msg></body_msg>\")\n            tree = html.fromstring(value)\n            odoo_anchors = tree.xpath('//a[contains(@href,\"odoo.com\")]')\n            for elem in odoo_anchors:\n                parent = elem.getparent()\n                previous = elem.getprevious()\n                if remove_before and not remove_parent and previous is not None:\n                    # remove 'using' that is before <a and after </span>\n                    previous.tail = \"\"\n                if remove_parent and len(parent.getparent()):\n                    # anchor <a href odoo has a parent powered by that must be removed\n                    parent.getparent().remove(parent)\n                else:\n                    if parent.tag == \"td\":  # also here can be powered by\n                        parent.getparent().remove(parent)\n                    else:\n                        parent.remove(elem)\n            value = etree.tostring(\n                tree, pretty_print=True, method=\"html\", encoding=\"unicode\"\n            )\n            if to_keep:\n                value = value.replace(\"<body_msg></body_msg>\", to_keep)\n        return value\n\n    @api.model\n    def _render_template(\n        self,\n        template_src,\n        model,\n        res_ids,\n        engine=\"jinja\",\n        add_context=None,\n        post_process=False,\n    ):\n        \"\"\"replace anything that is with odoo in templates\n        if is a <a that contains odoo will delete it completly\n        original:\n         Render the given string on records designed by model / res_ids using\n        the given rendering engine. Currently only jinja is supported.\n\n        :param str template_src: template text to render (jinja) or  (qweb)\n          this could be cleaned but hey, we are in a rush\n        :param str model: model name of records on which we want to perform rendering\n        :param list res_ids: list of ids of records (all belonging to same model)\n        :param string engine: jinja\n        :param post_process: perform rendered str / html post processing (see\n          ``_render_template_postprocess``)\n\n        :return dict: {res_id: string of rendered template based on record}\"\"\"\n        orginal_rendered = super()._render_template(\n            template_src,\n            model,\n            res_ids,\n            engine=engine,\n            add_context=add_context,\n            post_process=post_process,\n        )\n\n        for key in res_ids:\n            orginal_rendered[key] = self.remove_href_odoo(orginal_rendered[key])\n\n        return orginal_rendered\n\n    def _replace_local_links(self, html, base_url=None):\n        message = super()._replace_local_links(html)\n        message = re.sub(\n            r\"\"\"(Powered by\\s(.*)Odoo</a>)\"\"\", \"<div>&nbsp;</div>\", message\n        )\n        return message\n", "path": "mail_debrand/models/mail_render_mixin.py"}]}