HimoolERP/scripts/create_test_data.py

18 lines
828 B
Python
Raw Normal View History

2021-11-12 01:03:17 +08:00
from django.db import transaction
from apps.data.models import *
from apps.goods.models import *
from apps.system.models import *
def run(*args):
team = Team.objects.all().first()
with transaction.atomic():
Account.objects.create(number='A001', name='默认账户', team=team)
2021-11-12 22:07:49 +08:00
Client.objects.create(number='C001', name='默认客户', team=team)
2021-11-12 01:03:17 +08:00
Supplier.objects.create(number='S001', name='默认供应商', team=team)
2021-11-12 22:07:49 +08:00
2021-11-12 01:03:17 +08:00
warehouse = Warehouse.objects.create(number='W001', name='默认仓库', team=team)
2022-04-02 23:06:18 +08:00
goods = Goods.objects.create(number='G001', name='产品A', purchase_price=10, retail_price=20,
2021-11-12 01:03:17 +08:00
level_price1=20, level_price2=20, level_price3=20, team=team)
Inventory.objects.create(warehouse=warehouse, goods=goods, team=team)