allow negative balance
This commit is contained in:
parent
0fd988204a
commit
215d645b19
1 changed files with 20 additions and 12 deletions
|
@ -51,7 +51,17 @@ def pay(request, pk):
|
|||
|
||||
if form.is_valid():
|
||||
sale = form.to_sale()
|
||||
if float(sale.price + account.balance) >= 0:
|
||||
# if float(sale.price + account.balance) >= 0:
|
||||
# sale.account = account
|
||||
# sale.save()
|
||||
# account.calc_balance()
|
||||
# account.save()
|
||||
# messages.success(
|
||||
# request,
|
||||
# "Paiement de {}€ réalisé avec succès.".format(sale.price)
|
||||
# )
|
||||
# else:
|
||||
# messages.error(request, "Solde trop bas pour l'opération")
|
||||
sale.account = account
|
||||
sale.save()
|
||||
account.calc_balance()
|
||||
|
@ -60,9 +70,7 @@ def pay(request, pk):
|
|||
request,
|
||||
"Paiement de {}€ réalisé avec succès.".format(sale.price)
|
||||
)
|
||||
else:
|
||||
messages.error(request, "Solde trop bas pour l'opération")
|
||||
return redirect(reverse('account', args=[account.pk,]))
|
||||
return redirect(reverse('account', args=[account.pk]))
|
||||
|
||||
return render(
|
||||
request,
|
||||
|
|
Loading…
Reference in a new issue