diff options
Diffstat (limited to 'odoo/tools/template_inheritance.py')
| -rw-r--r-- | odoo/tools/template_inheritance.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/odoo/tools/template_inheritance.py b/odoo/tools/template_inheritance.py index 347e022d87b..7f84f97d225 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, inherit_branding=False): +def apply_inheritance_specs(source, specs_tree, inherit_branding=False, pre_locate=lambda s: True): """ Apply an inheriting view (a descendant of the base view) Apply to a source architecture all the spec nodes (i.e. nodes @@ -82,6 +82,9 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False): architecture) given by an inheriting view. :param Element source: a parent architecture to modify + :param pre_locate: function that is executed before locating a node. + This function receives an arch as argument. + This is required by studio to properly handle group_ids. :return: a modified source where the specs are applied :rtype: Element """ @@ -99,6 +102,7 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False): _("Invalid specification for moved nodes: '%s'") % etree.tostring(spec) ) + pre_locate(spec) to_extract = locate_node(source, spec) if to_extract is not None: remove_element(to_extract) @@ -116,6 +120,7 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False): if spec.tag == 'data': specs += [c for c in spec] continue + pre_locate(spec) node = locate_node(source, spec) if node is not None: pos = spec.get('position', 'inside') |
