summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-28 13:58:11 +0000
committerChristophe Simonis <chs@odoo.com>2019-01-28 13:58:11 +0000
commitcf52a04979d7634908c2f0d8eb6a83b7dd614f64 (patch)
tree2f8c25f3fab45268400c4ac6addfa15f1f2d37f0 /addons/web_editor/controllers
parentcd1f57e9ded2e8ca81d7290e4b5b95a8776045c6 (diff)
parentd3b8422c9c44557256836bdc0da5480f553eec4d (diff)
[MERGE] forward port branch saas-12.1 up to d3b8422c9c4
closes odoo/odoo#30614
Diffstat (limited to 'addons/web_editor/controllers')
-rw-r--r--addons/web_editor/controllers/main.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index bd267c5f32d..55facfa93d1 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -447,7 +447,17 @@ class Web_Editor(http.Controller):
# Create a view to extend the template which adds the original file to link the new modified version instead
IrUiView = request.env["ir.ui.view"]
- view_to_xpath = IrUiView.get_related_views(bundle_xmlid, bundles=True).filtered(lambda v: v.arch.find(url) >= 0)
+
+ def views_linking_url(view):
+ """
+ Returns whether the view arch has some html link tag linked to the url.
+
+ (note: searching for the URL string is not enough as it could appear in a comment or an xpath expression.)
+ """
+ return bool(etree.XML(view.arch).xpath("link[@href='{}']".format(url)))
+
+ view_to_xpath = IrUiView.get_related_views(bundle_xmlid, bundles=True).filtered(views_linking_url)
+
new_view = {
'name': custom_url,
'key': 'web_editor.scss_%s' % str(uuid.uuid4())[:6],