summaryrefslogtreecommitdiff
path: root/odoo/tools
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-10-15 11:37:03 +0000
committerfw-bot <otis@odoo.com>2019-10-28 14:15:53 +0000
commitbbbfca2d97290abf8b77173c7d2c9c935d00ce14 (patch)
tree7f2f25a4af621575a3e59c5be07971e7767fcdba /odoo/tools
parenteccfdd5512375099d578ccd686fdd71a8cdcec93 (diff)
[FIX] web, tools: static inheritance supports replace in debug mode
Have a parent template Have a child, in extension inherit mode of the parent The child has a xpath like `<xpath expr="." position="replace" />` Before this commit, there was a crash. That was because the Comment (which indicates which templates modified the parent) was taken as the replacer node instead of the actual content of the xpath After this commit, there is no crash, and it works as expected closes odoo/odoo#39453 X-original-commit: 02d790e1d21b78395e489f57bf30c82f728cbee6 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'odoo/tools')
-rw-r--r--odoo/tools/template_inheritance.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/odoo/tools/template_inheritance.py b/odoo/tools/template_inheritance.py
index 7f84f97d225..e025cd32712 100644
--- a/odoo/tools/template_inheritance.py
+++ b/odoo/tools/template_inheritance.py
@@ -129,7 +129,20 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False, pre_loca
loc.text = ''
loc.append(copy.deepcopy(node))
if node.getparent() is None:
- source = copy.deepcopy(spec[0])
+ spec_content = None
+ comment = None
+ for content in spec:
+ if content.tag is not etree.Comment:
+ spec_content = content
+ break
+ else:
+ comment = content
+ source = copy.deepcopy(spec_content)
+ if comment is not None:
+ text = source.text
+ source.text = None
+ comment.tail = text
+ source.insert(0, comment)
else:
replaced_node_tag = None
for child in spec: