Skip to content

Commit

Permalink
[FIX] mail_debrand: Avoid odoo.sh links removal (url like my-customer…
Browse files Browse the repository at this point in the history
….odoo.com)

Forward of OCA#1181
Issue: OCA#1375
  • Loading branch information
BurkhalterY committed Feb 13, 2025
1 parent 8a0f8fd commit b7f1aff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mail_debrand/models/mail_render_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def remove_href_odoo(self, value, to_keep=None):
has_dev_odoo_link = re.search(
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:
# 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.
if to_keep:
value = value.replace(to_keep, "<body_msg></body_msg>")
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:
parent = elem.getparent()
# Remove "Powered by", "using" etc.
Expand Down

0 comments on commit b7f1aff

Please sign in to comment.