mirror of
https://github.com/himool/HimoolERP.git
synced 2024-11-15 11:58:42 +08:00
20 lines
635 B
Python
20 lines
635 B
Python
from apps.system.models import PermissionGroup, Permission
|
|
|
|
|
|
PERMISSIONS = [
|
|
{
|
|
'name': '数据报表',
|
|
'permissions': [
|
|
{'name': '库存报表', 'code': 'warehouse_inventory'},
|
|
],
|
|
},
|
|
]
|
|
|
|
|
|
def run(*args):
|
|
PermissionGroup.objects.all().delete()
|
|
|
|
for permission_group_item in PERMISSIONS:
|
|
permission_group = PermissionGroup.objects.create(name=permission_group_item['name'])
|
|
Permission.objects.bulk_create([Permission(group=permission_group, name=item['name'], code=item['code'])
|
|
for item in permission_group_item['permissions']])
|