summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-18 14:26:33 +0100
committerChristophe Simonis <chs@odoo.com>2019-01-18 14:26:33 +0100
commita337b9ec92943017089ff24ea35ca592557121aa (patch)
treed8b111991257d17aa7d9325ef15bf11730b988e6 /addons/web_editor/controllers
parentf8e37d6a808a302cda973bc0c6f2b275355ef74c (diff)
parentf854e01a983334e214357b4e05083b9a96a61be7 (diff)
[MERGE] forward port branch 12.0 up to f854e01a983
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 1b3f03966f3..40cf2aba5ef 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -416,7 +416,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],