summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-17 20:49:36 +0100
committerChristophe Simonis <chs@odoo.com>2019-01-17 20:49:36 +0100
commit4aa153e65cf2995e3c109dab2958501e3911ff94 (patch)
treec8a8b6cab833200f78776589f67a0cb3f868ea2f /addons/web_editor/controllers
parent83cc046e9a90e8592d0d47c7162ab7bd923621ba (diff)
parent19558129f0e2d5c9940f6fa95534840f8f025547 (diff)
[MERGE] forward port branch 11.0 up to 19558129f0e
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 0aa3dd24753..f0aae0ee8fe 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -389,7 +389,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)
+
IrUiView.create(dict(
name = custom_url,
mode = "extension",