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/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 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
  • - +