diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-08-14 16:48:10 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-08-14 16:48:10 +0200 |
| commit | 140ee6b8f0b0de7ddcc816496269963612c5d0c6 (patch) | |
| tree | 7bdaa065d215b88fea4fa56adbfa79cdc24deb69 /odoo/tools/template_inheritance.py | |
| parent | 839696d2d7dd574fd8958d17726379926e94d590 (diff) | |
| parent | 98a55917a602c0c47093b4270ebc4e8b416ecf32 (diff) | |
[MERGE] forward port branch saas-12.4 up to 98a55917a60
Diffstat (limited to 'odoo/tools/template_inheritance.py')
| -rw-r--r-- | odoo/tools/template_inheritance.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/odoo/tools/template_inheritance.py b/odoo/tools/template_inheritance.py index 3b55dd08c4e..347e022d87b 100644 --- a/odoo/tools/template_inheritance.py +++ b/odoo/tools/template_inheritance.py @@ -74,7 +74,7 @@ def locate_node(arch, spec): return None -def apply_inheritance_specs(source, specs_tree): +def apply_inheritance_specs(source, specs_tree, inherit_branding=False): """ Apply an inheriting view (a descendant of the base view) Apply to a source architecture all the spec nodes (i.e. nodes @@ -126,9 +126,19 @@ def apply_inheritance_specs(source, specs_tree): if node.getparent() is None: source = copy.deepcopy(spec[0]) else: + replaced_node_tag = None for child in spec: if child.get('position') == 'move': child = extract(child) + if inherit_branding and not replaced_node_tag and child.tag is not etree.Comment: + # To make a correct branding, we need to + # - know exactly which node has been replaced + # - store it before anything else has altered the Tree + # Do it exactly here :D + child.set('meta-oe-xpath-replacing', node.tag) + # We just store the replaced node tag on the first + # child of the xpath replacing it + replaced_node_tag = node.tag node.addprevious(child) node.getparent().remove(node) elif pos == 'attributes': |
