3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-22 11:23:11 +00:00

Merge branch 'fix-3.3.2' into 'dev'

Fix 3.3.2

See merge request coope/coopev3!12
This commit is contained in:
Nanoy 2019-01-24 22:36:30 +01:00
commit 511c75d2c2
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 ## v3.3.1
* contains devient icontains pour enlever la sensibilité à la casse * contains devient icontains pour enlever la sensibilité à la casse
## v3.3.0 ## v3.3.0

View file

@ -169,13 +169,6 @@ def order(request):
raise Exception(error_message) raise Exception(error_message)
for pinte in listPintes: for pinte in listPintes:
allocate(pinte, user) 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: for o in order:
product = get_object_or_404(Product, pk=o["pk"]) product = get_object_or_404(Product, pk=o["pk"])
quantity = int(o["quantity"]) quantity = int(o["quantity"])
@ -212,7 +205,7 @@ def order(request):
consumption.save() consumption.save()
ch = ConsumptionHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, product=product, amount=Decimal(quantity*product.amount), coopeman=request.user) ch = ConsumptionHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, product=product, amount=Decimal(quantity*product.amount), coopeman=request.user)
ch.save() 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) user.profile.debit += Decimal(product.amount*quantity)
else: else:
error_message = "Solde insuffisant" error_message = "Solde insuffisant"
@ -222,7 +215,7 @@ def order(request):
quantity = int(m["quantity"]) quantity = int(m["quantity"])
mh = MenuHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, menu=menu, amount=int(quantity*menu.amount), coopeman=request.user) mh = MenuHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, menu=menu, amount=int(quantity*menu.amount), coopeman=request.user)
mh.save() 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) user.profile.debit += Decimal(menu.amount*quantity)
else: else:
error_message = "Solde insuffisant" error_message = "Solde insuffisant"
@ -234,6 +227,7 @@ def order(request):
if(article.stockHold > 0): if(article.stockHold > 0):
article.stockHold -= 1 article.stockHold -= 1
article.save() article.save()
user.save()
return HttpResponse("La commande a bien été effectuée") return HttpResponse("La commande a bien été effectuée")
except Exception as e: except Exception as e:
print(e) print(e)
@ -753,7 +747,7 @@ def kegsList(request):
:template:`gestion/kegs_list.html` :template:`gestion/kegs_list.html`
""" """
kegs_active = KegHistory.objects.filter(isCurrentKegHistory=True) 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) kegs_inactive = Keg.objects.exclude(id__in = ids_actives)
return render(request, "gestion/kegs_list.html", {"kegs_active": kegs_active, "kegs_inactive": kegs_inactive}) 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> <li><a href="https://www.facebook.com/coopesmetz/" class="icon fa-facebook alt"><span class="label">Facebook</span></a></li>
</ul> </ul>
</section> </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>