mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
Use app label rather than table name for permission lookup
- For legacy reasons there are some tables that are not named according to their app_label - Simply use the app_label instead
This commit is contained in:
@ -66,9 +66,9 @@ class RuleSet(models.Model):
|
||||
'part_parttesttemplate',
|
||||
'part_partparametertemplate',
|
||||
'part_partparameter',
|
||||
'part_supplierpart',
|
||||
'part_partrelated',
|
||||
'part_partstar',
|
||||
'company_supplierpart',
|
||||
],
|
||||
'stock_location': [
|
||||
'stock_stocklocation',
|
||||
@ -95,11 +95,11 @@ class RuleSet(models.Model):
|
||||
],
|
||||
'purchase_order': [
|
||||
'company_company',
|
||||
'part_supplierpart',
|
||||
'company_supplierpricebreak',
|
||||
'order_purchaseorder',
|
||||
'order_purchaseorderattachment',
|
||||
'order_purchaseorderlineitem',
|
||||
'company_supplierpart',
|
||||
],
|
||||
'sales_order': [
|
||||
'company_company',
|
||||
@ -343,7 +343,7 @@ def update_group_roles(group, debug=False):
|
||||
content_type = ContentType.objects.get(app_label=app, model=model)
|
||||
permission = Permission.objects.get(content_type=content_type, codename=perm)
|
||||
except ContentType.DoesNotExist:
|
||||
print(f"Error: Could not find permission matching '{permission_string}'")
|
||||
raise ValueError(f"Error: Could not find permission matching '{permission_string}'")
|
||||
permission = None
|
||||
|
||||
return permission
|
||||
|
Reference in New Issue
Block a user