diff --git a/CHANGELOG.md b/CHANGELOG.md index 60384da..54aec35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v3.3.2 +* fix de la vérification du solde dans la commande +* fix de l'affichage de la liste des fûts ## v3.3.1 * contains devient icontains pour enlever la sensibilité à la casse ## v3.3.0 diff --git a/gestion/views.py b/gestion/views.py index ff9fbd2..a296971 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -169,13 +169,6 @@ def order(request): raise Exception(error_message) for pinte in listPintes: allocate(pinte, user) - if(paymentMethod.affect_balance): - if(user.profile.balance < amount): - error_message = "Solde inférieur au prix de la commande" - raise Exception(error_message) - else: - user.profile.debit += amount - user.save() for o in order: product = get_object_or_404(Product, pk=o["pk"]) quantity = int(o["quantity"]) @@ -212,7 +205,7 @@ 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)): + if(user.profile.balance >= Decimal(product.amount*quantity)): user.profile.debit += Decimal(product.amount*quantity) else: error_message = "Solde insuffisant" @@ -222,7 +215,7 @@ def order(request): 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)): + if(user.profile.balance >= Decimal(menu.amount*quantity)): user.profile.debit += Decimal(menu.amount*quantity) else: error_message = "Solde insuffisant" @@ -234,6 +227,7 @@ def order(request): if(article.stockHold > 0): article.stockHold -= 1 article.save() + user.save() return HttpResponse("La commande a bien été effectuée") except Exception as e: print(e) @@ -753,7 +747,7 @@ def kegsList(request): :template:`gestion/kegs_list.html` """ kegs_active = KegHistory.objects.filter(isCurrentKegHistory=True) - ids_actives = kegs_active.values('id') + ids_actives = kegs_active.values('keg__id') kegs_inactive = Keg.objects.exclude(id__in = ids_actives) return render(request, "gestion/kegs_list.html", {"kegs_active": kegs_active, "kegs_inactive": kegs_inactive}) diff --git a/templates/footer.html b/templates/footer.html index f444a7d..ec752b6 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -39,6 +39,6 @@
coope.rez v3.3.1 (release stable) © 2018 Yoann Pietri.
+coope.rez v3.3.2 (release stable) © 2018 Yoann Pietri.