From 0b76d1d0365ab2acaef635ae4572a2ac6ee68f23 Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 5 Nov 2020 09:34:18 -0500 Subject: [PATCH 1/2] Check if permission is not NoneType before adding to group --- InvenTree/users/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/users/models.py b/InvenTree/users/models.py index 9dd117f1bd..7fc9145427 100644 --- a/InvenTree/users/models.py +++ b/InvenTree/users/models.py @@ -316,7 +316,8 @@ def update_group_roles(group, debug=False): permission = get_permission_object(perm) - group.permissions.add(permission) + if permission: + group.permissions.add(permission) if debug: print(f"Adding permission {perm} to group {group.name}") From 684db677335c22566fb28605c0c3f57a71ca8aa8 Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 5 Nov 2020 09:37:01 -0500 Subject: [PATCH 2/2] Added check for remove too --- InvenTree/users/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/users/models.py b/InvenTree/users/models.py index 7fc9145427..98efb14764 100644 --- a/InvenTree/users/models.py +++ b/InvenTree/users/models.py @@ -331,7 +331,8 @@ def update_group_roles(group, debug=False): permission = get_permission_object(perm) - group.permissions.remove(permission) + if permission: + group.permissions.remove(permission) if debug: print(f"Removing permission {perm} from group {group.name}")