From c6f45b4407e6c1a502bad865301599c4f4b58849 Mon Sep 17 00:00:00 2001 From: Nanoy Date: Sat, 26 Jan 2019 17:02:23 +0100 Subject: [PATCH 1/2] Fix order --- gestion/views.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gestion/views.py b/gestion/views.py index a296971..d0ed794 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -205,21 +205,23 @@ def order(request): consumption.save() ch = ConsumptionHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, product=product, amount=Decimal(quantity*product.amount), coopeman=request.user) ch.save() - if(user.profile.balance >= Decimal(product.amount*quantity)): - user.profile.debit += Decimal(product.amount*quantity) - else: - error_message = "Solde insuffisant" - raise Exception(error_message) + if(paymentMethod.affect_balance): + if(user.profile.balance >= Decimal(product.amount*quantity)): + user.profile.debit += Decimal(product.amount*quantity) + else: + error_message = "Solde insuffisant" + raise Exception(error_message) for m in menus: menu = get_object_or_404(Menu, pk=m["pk"]) quantity = int(m["quantity"]) mh = MenuHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, menu=menu, amount=int(quantity*menu.amount), coopeman=request.user) mh.save() - if(user.profile.balance >= Decimal(menu.amount*quantity)): - user.profile.debit += Decimal(menu.amount*quantity) - else: - error_message = "Solde insuffisant" - raise Exception(error_message) + if(paymentMethod.affect_balance): + if(user.profile.balance >= Decimal(product.amount*quantity)): + user.profile.debit += Decimal(product.amount*quantity) + else: + error_message = "Solde insuffisant" + raise Exception(error_message) for article in menu.articles.all(): consumption, _ = Consumption.objects.get_or_create(customer=user, product=article) consumption.quantity += quantity From 72bc1c7619c8b700cb44ed3d08128d240b979176 Mon Sep 17 00:00:00 2001 From: Nanoy Date: Sat, 26 Jan 2019 17:03:14 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20informations?= =?UTF-8?q?=20de=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ templates/footer.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54aec35..91b4501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v3.3.3 +* fix commande (moyen de paiment n'affectant pas le solde) ## v3.3.2 * fix de la vérification du solde dans la commande * fix de l'affichage de la liste des fûts diff --git a/templates/footer.html b/templates/footer.html index ec752b6..76024bd 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -39,6 +39,6 @@
  • Facebook
  • - +