Enregistrement d'opérations K-Psul

- Le solde (balance) du compte sur lequel a été effectuée la commande
  est mis à jour
This commit is contained in:
Aurélien Delobelle 2016-08-08 00:34:09 +02:00
parent e55d45b559
commit d065c7634c

View file

@ -452,6 +452,9 @@ def kpsul_perform_operations(request):
# Filling cof status for statistics # Filling cof status for statistics
operationgroup.is_cof = operationgroup.on_acc.is_cof operationgroup.is_cof = operationgroup.on_acc.is_cof
# Updating account's balance
operationgroup.on_acc.balance += operationgroup.amount
# Apply all saves in a transaction to ensure database integrity # Apply all saves in a transaction to ensure database integrity
try: try:
with transaction.atomic(): with transaction.atomic():
@ -459,6 +462,9 @@ def kpsul_perform_operations(request):
operationgroup.save() operationgroup.save()
data['operationgroup'] = operationgroup.pk data['operationgroup'] = operationgroup.pk
# Saving account with new balance
operationgroup.on_acc.save()
# Filling operationgroup id for each operations and saving # Filling operationgroup id for each operations and saving
for operation in operations: for operation in operations:
operation.group = operationgroup operation.group = operationgroup