forked from DGNum/gestioCOF
Add better checkout creation
This commit is contained in:
parent
3acc8bca75
commit
f512c1bdd7
1 changed files with 17 additions and 4 deletions
|
@ -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__)),
|
||||||
|
@ -96,13 +97,25 @@ class Command(MyBaseCommand):
|
||||||
# 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
|
||||||
|
)
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Opérations
|
# Opérations
|
||||||
# ---
|
# ---
|
||||||
|
|
Loading…
Reference in a new issue