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.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 ## v3.3.2
* fix de la vérification du solde dans la commande * fix de la vérification du solde dans la commande
* fix de l'affichage de la liste des fûts * fix de l'affichage de la liste des fûts

View file

@ -205,21 +205,23 @@ 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(paymentMethod.affect_balance):
user.profile.debit += Decimal(product.amount*quantity) if(user.profile.balance >= Decimal(product.amount*quantity)):
else: user.profile.debit += Decimal(product.amount*quantity)
error_message = "Solde insuffisant" else:
raise Exception(error_message) error_message = "Solde insuffisant"
raise Exception(error_message)
for m in menus: for m in menus:
menu = get_object_or_404(Menu, pk=m["pk"]) menu = get_object_or_404(Menu, pk=m["pk"])
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(paymentMethod.affect_balance):
user.profile.debit += Decimal(menu.amount*quantity) if(user.profile.balance >= Decimal(product.amount*quantity)):
else: user.profile.debit += Decimal(product.amount*quantity)
error_message = "Solde insuffisant" else:
raise Exception(error_message) error_message = "Solde insuffisant"
raise Exception(error_message)
for article in menu.articles.all(): for article in menu.articles.all():
consumption, _ = Consumption.objects.get_or_create(customer=user, product=article) consumption, _ = Consumption.objects.get_or_create(customer=user, product=article)
consumption.quantity += quantity 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> <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.2 (release stable) &copy; 2018 Yoann Pietri.</p> <p class="copyright">coope.rez v3.3.3 (release stable) &copy; 2018 Yoann Pietri.</p>