diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-18 10:58:41 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-18 10:58:41 +0100 |
| commit | f854e01a983334e214357b4e05083b9a96a61be7 (patch) | |
| tree | 5ee4129d8b69f2cc92fb7eb0f143197520432cbb /addons/web_editor/controllers | |
| parent | e6b5a0e2ebe807ff14492c688c3a57bfad6f8e1b (diff) | |
| parent | 4aa153e65cf2995e3c109dab2958501e3911ff94 (diff) | |
[MERGE] forward port branch saas-11.3 up to 4aa153e65cf
Diffstat (limited to 'addons/web_editor/controllers')
| -rw-r--r-- | addons/web_editor/controllers/main.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 3b1f3cc8ac1..27e4419afe9 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -417,7 +417,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], |
