mirror of https://github.com/OCA/social.git
[FIX] mail_debrand: Avoid odoo.sh links removal
For URLs like my-customer.odoo.com Forward of #1181 Issue: #1375pull/1595/head
parent
8a0f8fd2b2
commit
deb52b4bd6
|
@ -28,14 +28,14 @@ class MailRenderMixin(models.AbstractModel):
|
||||||
has_dev_odoo_link = re.search(
|
has_dev_odoo_link = re.search(
|
||||||
r"<a\s(.*)dev\.odoo\.com", value, flags=re.IGNORECASE
|
r"<a\s(.*)dev\.odoo\.com", value, flags=re.IGNORECASE
|
||||||
)
|
)
|
||||||
has_odoo_link = re.search(r"<a\s(.*)odoo\.com", value, flags=re.IGNORECASE)
|
has_odoo_link = re.search(r"<a\s(.*)www\.odoo\.com", value, flags=re.IGNORECASE)
|
||||||
if has_odoo_link and not has_dev_odoo_link:
|
if has_odoo_link and not has_dev_odoo_link:
|
||||||
# We don't want to change what was explicitly added in the message body,
|
# 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.
|
# so we will only change what is before and after it.
|
||||||
if to_keep:
|
if to_keep:
|
||||||
value = value.replace(to_keep, "<body_msg></body_msg>")
|
value = value.replace(to_keep, "<body_msg></body_msg>")
|
||||||
tree = html.fromstring(value)
|
tree = html.fromstring(value)
|
||||||
odoo_anchors = tree.xpath('//a[contains(@href,"odoo.com")]')
|
odoo_anchors = tree.xpath('//a[contains(@href,"www.odoo.com")]')
|
||||||
for elem in odoo_anchors:
|
for elem in odoo_anchors:
|
||||||
parent = elem.getparent()
|
parent = elem.getparent()
|
||||||
# Remove "Powered by", "using" etc.
|
# Remove "Powered by", "using" etc.
|
||||||
|
|
Loading…
Reference in New Issue