3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-25 12:53:11 +00:00

Merge branch 'fix-3.3.2' into 'master'

Fix 3.3.2

See merge request coope/coopev3!11
This commit is contained in:
Nanoy 2019-01-24 22:36:40 +01:00
commit 320022adf1
3 changed files with 8 additions and 11 deletions

View file

@ -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

View file

@ -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})

View file

@ -39,6 +39,6 @@
<li><a href="https://www.facebook.com/coopesmetz/" class="icon fa-facebook alt"><span class="label">Facebook</span></a></li>
</ul>
</section>
<p class="copyright">coope.rez v3.3.1 (release stable) &copy; 2018 Yoann Pietri.</p>
<p class="copyright">coope.rez v3.3.2 (release stable) &copy; 2018 Yoann Pietri.</p>