mirror of
https://github.com/himool/HimoolERP.git
synced 2024-12-26 08:51:32 +08:00
20 lines
626 B
Python
20 lines
626 B
Python
from apps.system.models import PermissionType, Permission
|
|
|
|
|
|
PERMISSIONS = [
|
|
{
|
|
'name': '数据报表',
|
|
'permissions': [
|
|
{'name': '库存报表', 'code': 'warehouse_inventory'},
|
|
],
|
|
},
|
|
]
|
|
|
|
|
|
def run(*args):
|
|
PermissionType.objects.all().delete()
|
|
|
|
for permission_type_item in PERMISSIONS:
|
|
permission_type = PermissionType.objects.create(name=permission_type_item['name'])
|
|
Permission.objects.bulk_create([Permission(type=permission_type, name=item['name'], code=item['code'])
|
|
for item in permission_type_item['permissions']])
|