From cd6dbc82e7d5c63d9d3444d91877d0326bd9a4f3 Mon Sep 17 00:00:00 2001 From: nanoy Date: Tue, 18 Dec 2018 11:38:20 +0100 Subject: [PATCH] Fix rechargement --- gestion/views.py | 10 ++++++---- templates/footer.html | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gestion/views.py b/gestion/views.py index b0832d7..92d389a 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -231,8 +231,9 @@ def cancel_consumption(request, pk): """ consumption = get_object_or_404(ConsumptionHistory, pk=pk) user = consumption.customer - user.profile.debit -= consumption.amount - user.save() + if consumption.paymentMethod.affect_balance: + user.profile.debit -= consumption.amount + user.save() consumptionT = Consumption.objects.get(customer=user, product=consumption.product) consumptionT.quantity -= consumption.quantity consumptionT.save() @@ -252,8 +253,9 @@ def cancel_menu(request, pk): """ menu_history = get_object_or_404(MenuHistory, pk=pk) user = menu_history.customer - user.profile.debit -= menu_history.amount - user.save() + if menu_history.paymentMethod.affect_balance: + user.profile.debit -= menu_history.amount + user.save() for product in manu_history.menu.articles: consumptionT = Consumption.objects.get(customer=user, product=product) consumptionT -= menu_history.quantity diff --git a/templates/footer.html b/templates/footer.html index 37254c6..a00259d 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -39,5 +39,5 @@
  • Facebook
  • - +