Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][FIX] mail_debrand: Avoid odoo.sh links removal (url like my-customer.odoo.com) #1595

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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