diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index 6904e950e23..f55f44591e8 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -1036,8 +1036,8 @@ actual arch. for node in tree.xpath('//*[@groups]'): if not self.user_has_groups(node.attrib.pop('groups')): node.getparent().remove(node) - elif node.tag == 't' and not node.attrib: - # Move content of blocks with no other instructions than just "groups=" to the parent + elif node.get('postprocess_remove'): + # Move content of blocks created in `_postprocess_tag_field` to the parent # and remove the node. # This is to keep the structure # @@ -1045,6 +1045,14 @@ actual arch. # # # so the web client adds the label as expected. + # This is also to avoid having nodes in tree views + # e.g. + # + # + # + # + # + # for child in reversed(node): node.addnext(child) node.getparent().remove(node) @@ -1215,7 +1223,7 @@ actual arch. # set on the field in the Python model # e.g. # The node will be removed later, in _postprocess_access_rights. - node_t = E.t(groups=field.groups) + node_t = E.t(groups=field.groups, postprocess_remove="1") node.getparent().replace(node, node_t) node_t.append(node) else: