File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ def _update_user_groups_view(self):
5353 )
5454
5555 arch_root = arch .xpath ("//field[@name='groups_id']" )[0 ]
56- if arch_root :
56+ if len ( arch_root ) and portal_groups :
5757 # as the original construction of the groups view makes all xml-groups
5858 # per application invisible, it is 'easier' to create another section for
59- # portal users and append those at the bottom of the view
59+ # portal users and append the whole section at the bottom of the view
6060 portal_group_elem = etree .SubElement (
6161 arch_root ,
6262 "group" ,
@@ -70,14 +70,17 @@ def _update_user_groups_view(self):
7070 for app_id , app_name in portal_groups .mapped ("category_id" ).name_get () + [
7171 (False , "Other" )
7272 ]:
73+ portal_groups_in_app = portal_groups .filtered (
74+ lambda r : (r .category_id .id or False ) == app_id
75+ )
76+ if not portal_groups_in_app :
77+ continue
7378 app_group_elem = etree .SubElement (
7479 portal_group_elem ,
7580 "group" ,
7681 string = app_name ,
7782 )
78- for group in portal_groups .filtered (
79- lambda r : (r .category_id .id or False ) == app_id
80- ):
83+ for group in portal_groups_in_app :
8184 field_name = name_boolean_group (group .id )
8285 for field_node in arch .xpath ("//field[@name='%s']" % field_name ):
8386 field_node .attrib ["attrs" ] = non_public_attrs
You can’t perform that action at this time.
0 commit comments