From 03c698efc6f9b9647b594d0d80c697b28f019933 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 11 Dec 2018 10:58:33 +0100 Subject: [PATCH] [FIX] don't break when there are no dynamic groups --- auth_dynamic_groups/model/res_users.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/auth_dynamic_groups/model/res_users.py b/auth_dynamic_groups/model/res_users.py index 8ce916e19..bcfd2d0ad 100644 --- a/auth_dynamic_groups/model/res_users.py +++ b/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(