Merge branch 'Aufinal/fix_kfet_devdata' into 'master'
Données de test K-Fêt See merge request !191
This commit is contained in:
commit
a057869d77
|
@ -12,7 +12,8 @@ from django.contrib.auth.models import User, Group, Permission, ContentType
|
||||||
|
|
||||||
from gestioncof.management.base import MyBaseCommand
|
from gestioncof.management.base import MyBaseCommand
|
||||||
from gestioncof.models import CofProfile
|
from gestioncof.models import CofProfile
|
||||||
from kfet.models import Account, Article, OperationGroup, Operation, Checkout
|
from kfet.models import (Account, Article, OperationGroup, Operation,
|
||||||
|
Checkout, CheckoutStatement)
|
||||||
|
|
||||||
# Où sont stockés les fichiers json
|
# Où sont stockés les fichiers json
|
||||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||||
|
@ -87,20 +88,42 @@ class Command(MyBaseCommand):
|
||||||
|
|
||||||
# Compte liquide
|
# Compte liquide
|
||||||
|
|
||||||
|
self.stdout.write("Création du compte liquide")
|
||||||
liq_user, _ = User.objects.get_or_create(username='liquide')
|
liq_user, _ = User.objects.get_or_create(username='liquide')
|
||||||
liq_profile, _ = CofProfile.objects.get_or_create(user=liq_user)
|
liq_profile, _ = CofProfile.objects.get_or_create(user=liq_user)
|
||||||
liq_account, _ = Account.objects.get_or_create(cofprofile=liq_profile,
|
liq_account, _ = Account.objects.get_or_create(cofprofile=liq_profile,
|
||||||
trigramme='LIQ')
|
trigramme='LIQ')
|
||||||
|
|
||||||
|
# Root account if existing
|
||||||
|
|
||||||
|
root_profile = CofProfile.objects.filter(user__username='root')
|
||||||
|
if root_profile.exists():
|
||||||
|
self.stdout.write("Création du compte K-Fêt root")
|
||||||
|
root_profile = root_profile.get()
|
||||||
|
Account.objects.get_or_create(cofprofile=root_profile,
|
||||||
|
trigramme='AAA')
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Caisse
|
# Caisse
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
checkout, _ = Checkout.objects.get_or_create(
|
checkout, created = Checkout.objects.get_or_create(
|
||||||
created_by=Account.objects.get(trigramme='000'),
|
created_by=Account.objects.get(trigramme='000'),
|
||||||
name='Chaudron',
|
name='Chaudron',
|
||||||
valid_from=timezone.now(),
|
defaults={
|
||||||
valid_to=timezone.now() + timedelta(days=365)
|
'valid_from': timezone.now(),
|
||||||
|
'valid_to': timezone.now() + timedelta(days=730)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if created:
|
||||||
|
CheckoutStatement.objects.create(
|
||||||
|
by=Account.objects.get(trigramme='000'),
|
||||||
|
checkout=checkout,
|
||||||
|
balance_old=0,
|
||||||
|
balance_new=0,
|
||||||
|
amount_taken=0,
|
||||||
|
amount_error=0
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
Loading…
Reference in a new issue