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

Merge branch 'fix-3.3.3' into 'dev'

Fix 3.3.3

See merge request coope/coopev3!14
This commit is contained in:
Nanoy 2019-01-26 17:04:38 +01:00
commit de65a5c726
3 changed files with 15 additions and 11 deletions

View file

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

View file

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

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.2 (release stable) &copy; 2018 Yoann Pietri.</p>
<p class="copyright">coope.rez v3.3.3 (release stable) &copy; 2018 Yoann Pietri.</p>