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

Bon prix dans les historiques de consommation

Close #4
This commit is contained in:
Yoann Pétri 2018-12-14 09:01:16 +01:00
parent 693bd93b51
commit dfec4e7b3c

View file

@ -158,7 +158,7 @@ def order(request):
consumption, _ = Consumption.objects.get_or_create(customer=user, product=product) consumption, _ = Consumption.objects.get_or_create(customer=user, product=product)
consumption.quantity += quantity consumption.quantity += quantity
consumption.save() consumption.save()
ch = ConsumptionHistory(customer = user, quantity = quantity, paymentMethod=paymentMethod, product=product, amount=int(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()
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"])