# Copyright 2019 O4SB - Graeme Gellatly # Copyright 2019 Tecnativa - Ernesto Tejeda # Copyright 2020 Onestein - Andrea Stirpe # Copyright 2021 Tecnativa - João Marques # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import re from lxml import etree, html from odoo import api, models class MailRenderMixin(models.AbstractModel): _inherit = "mail.render.mixin" def remove_href_odoo( self, value, remove_parent=True, remove_before=False, to_keep=None ): if len(value) < 20: return value # value can be bytes type; ensure we get a proper string if type(value) is bytes: value = value.decode() has_odoo_link = re.search(r" previous.tail = "" if remove_parent and len(parent.getparent()): # anchor )""", "
 
", message ) return message