mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
Merge remote-tracking branch 'inventree/master' into label-api
# Conflicts: # InvenTree/locale/de/LC_MESSAGES/django.po # InvenTree/locale/en/LC_MESSAGES/django.po # InvenTree/locale/es/LC_MESSAGES/django.po
This commit is contained in:
@ -30,6 +30,8 @@ class RuleSetInline(admin.TabularInline):
|
||||
max_num = len(RuleSet.RULESET_CHOICES)
|
||||
min_num = 1
|
||||
extra = 0
|
||||
# TODO: find better way to order inlines
|
||||
ordering = ['name']
|
||||
|
||||
|
||||
class InvenTreeGroupAdminForm(forms.ModelForm):
|
||||
@ -87,7 +89,8 @@ class RoleGroupAdmin(admin.ModelAdmin):
|
||||
RuleSetInline,
|
||||
]
|
||||
|
||||
list_display = ('name', 'admin', 'part', 'stock', 'build', 'purchase_order', 'sales_order')
|
||||
list_display = ('name', 'admin', 'part_category', 'part', 'stock_location',
|
||||
'stock_item', 'build', 'purchase_order', 'sales_order')
|
||||
|
||||
def get_rule_set(self, obj, rule_set_type):
|
||||
''' Return list of permissions for the given ruleset '''
|
||||
@ -130,10 +133,16 @@ class RoleGroupAdmin(admin.ModelAdmin):
|
||||
def admin(self, obj):
|
||||
return self.get_rule_set(obj, 'admin')
|
||||
|
||||
def part_category(self, obj):
|
||||
return self.get_rule_set(obj, 'part_category')
|
||||
|
||||
def part(self, obj):
|
||||
return self.get_rule_set(obj, 'part')
|
||||
|
||||
def stock(self, obj):
|
||||
def stock_location(self, obj):
|
||||
return self.get_rule_set(obj, 'stock_location')
|
||||
|
||||
def stock_item(self, obj):
|
||||
return self.get_rule_set(obj, 'stock')
|
||||
|
||||
def build(self, obj):
|
||||
|
18
InvenTree/users/migrations/0004_auto_20210113_1909.py
Normal file
18
InvenTree/users/migrations/0004_auto_20210113_1909.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.7 on 2021-01-13 19:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0003_auto_20201005_2227'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='ruleset',
|
||||
name='name',
|
||||
field=models.CharField(choices=[('admin', 'Admin'), ('part_category', 'Part Categories'), ('part', 'Parts'), ('stock_location', 'Stock Locations'), ('stock', 'Stock Items'), ('build', 'Build Orders'), ('purchase_order', 'Purchase Orders'), ('sales_order', 'Sales Orders')], help_text='Permission set', max_length=50),
|
||||
),
|
||||
]
|
@ -25,8 +25,10 @@ class RuleSet(models.Model):
|
||||
|
||||
RULESET_CHOICES = [
|
||||
('admin', _('Admin')),
|
||||
('part_category', _('Part Categories')),
|
||||
('part', _('Parts')),
|
||||
('stock', _('Stock')),
|
||||
('stock_location', _('Stock Locations')),
|
||||
('stock', _('Stock Items')),
|
||||
('build', _('Build Orders')),
|
||||
('purchase_order', _('Purchase Orders')),
|
||||
('sales_order', _('Sales Orders')),
|
||||
@ -48,21 +50,25 @@ class RuleSet(models.Model):
|
||||
'authtoken_token',
|
||||
'users_ruleset',
|
||||
],
|
||||
'part_category': [
|
||||
'part_partcategory',
|
||||
'part_partcategoryparametertemplate',
|
||||
],
|
||||
'part': [
|
||||
'part_part',
|
||||
'part_bomitem',
|
||||
'part_partcategory',
|
||||
'part_partattachment',
|
||||
'part_partsellpricebreak',
|
||||
'part_parttesttemplate',
|
||||
'part_partparametertemplate',
|
||||
'part_partparameter',
|
||||
'part_partrelated',
|
||||
'part_partcategoryparametertemplate',
|
||||
],
|
||||
'stock_location': [
|
||||
'stock_stocklocation',
|
||||
],
|
||||
'stock': [
|
||||
'stock_stockitem',
|
||||
'stock_stocklocation',
|
||||
'stock_stockitemattachment',
|
||||
'stock_stockitemtracking',
|
||||
'stock_stockitemtestresult',
|
||||
|
Reference in New Issue
Block a user