From d065c7634cf835d6da3106ec312adab6df5dcbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Mon, 8 Aug 2016 00:34:09 +0200 Subject: [PATCH] =?UTF-8?q?Enregistrement=20d'op=C3=A9rations=20K-Psul?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Le solde (balance) du compte sur lequel a été effectuée la commande est mis à jour --- kfet/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kfet/views.py b/kfet/views.py index 00e4f9fe..e81640ba 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -452,6 +452,9 @@ def kpsul_perform_operations(request): # Filling cof status for statistics 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 try: with transaction.atomic(): @@ -459,6 +462,9 @@ def kpsul_perform_operations(request): operationgroup.save() data['operationgroup'] = operationgroup.pk + # Saving account with new balance + operationgroup.on_acc.save() + # Filling operationgroup id for each operations and saving for operation in operations: operation.group = operationgroup