Browse Source
[FIX] don't break when there are no dynamic groups
pull/1455/head
Holger Brunn
6 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
1 changed files with
6 additions and
3 deletions
-
auth_dynamic_groups/model/res_users.py
|
|
@ -40,9 +40,12 @@ class res_users(Model): |
|
|
|
dynamic_groups = groups_obj.browse( |
|
|
|
cr, SUPERUSER_ID, groups_obj.search( |
|
|
|
cr, SUPERUSER_ID, [('is_dynamic', '=', True)])) |
|
|
|
cr.execute( |
|
|
|
'delete from res_groups_users_rel where uid=%s and gid in %s', |
|
|
|
(uid, tuple(dynamic_groups.ids))) |
|
|
|
if dynamic_groups: |
|
|
|
cr.execute( |
|
|
|
'delete from res_groups_users_rel ' |
|
|
|
'where uid=%s and gid in %s', |
|
|
|
(uid, tuple(dynamic_groups.ids)) |
|
|
|
) |
|
|
|
for dynamic_group in dynamic_groups: |
|
|
|
if dynamic_group.eval_dynamic_group_condition(uid=uid): |
|
|
|
cr.execute( |
|
|
|