I have a fix for the issue, here: ursais@6a3933f
This commit is contained in:
parent
93ed8b0398
commit
d37f6f0b36
@ -33,7 +33,7 @@ class MailRenderMixin(models.AbstractModel):
|
|||||||
only_what_is_in_tags = bytes_text[: bytes_text.rfind(b">") + 1]
|
only_what_is_in_tags = bytes_text[: bytes_text.rfind(b">") + 1]
|
||||||
data_formatted = html.fromstring(only_what_is_in_tags)
|
data_formatted = html.fromstring(only_what_is_in_tags)
|
||||||
parent.replace(previous, data_formatted)
|
parent.replace(previous, data_formatted)
|
||||||
if parent.getparent() and remove_parent:
|
if len(parent.getparent()) and remove_parent:
|
||||||
# anchor <a href odoo has a parent powered by that must be removed
|
# anchor <a href odoo has a parent powered by that must be removed
|
||||||
parent.getparent().remove(parent)
|
parent.getparent().remove(parent)
|
||||||
else:
|
else:
|
||||||
@ -42,12 +42,10 @@ class MailRenderMixin(models.AbstractModel):
|
|||||||
else:
|
else:
|
||||||
parent.remove(elem)
|
parent.remove(elem)
|
||||||
value = etree.tostring(tree, pretty_print=True, method="html")
|
value = etree.tostring(tree, pretty_print=True, method="html")
|
||||||
if type(value) is str:
|
# etree can return bytes; ensure we get a proper string
|
||||||
value = re.sub("[^(<)(</)]odoo", "", value, flags=re.IGNORECASE)
|
if type(value) is bytes:
|
||||||
elif type(value) is bytes:
|
value = value.decode()
|
||||||
value = re.sub(b"[^(<)(</)]odoo", b"", value, flags=re.IGNORECASE)
|
return re.sub("[^(<)(</)]odoo", "", value, flags=re.IGNORECASE)
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _render_template(
|
def _render_template(
|
||||||
|
Loading…
Reference in New Issue
Block a user