8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-01 07:22:25 +00:00

[cotisations] Replace Float by Decimal everywhere

This commit is contained in:
Maxime Bombar 2018-10-02 02:22:04 +02:00
parent f6dc63aac2
commit 5c8e90fde8
3 changed files with 4 additions and 4 deletions

View file

@ -233,7 +233,7 @@ class RechargeForm(FormRevMixin, Form):
"""
Form used to refill a user's balance
"""
value = forms.FloatField(
value = forms.DecimalField(
label=_("Amount"),
min_value=0.01,
validators=[]

View file

@ -83,7 +83,7 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
).aggregate(
total=models.Sum(
models.F('prix')*models.F('number'),
output_field=models.FloatField()
output_field=models.DecimalField()
)
)['total'] or 0

View file

@ -73,7 +73,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
"""
user = invoice.user
total_price = invoice.prix_total()
if float(user.solde) - float(total_price) < self.minimum_balance:
if user.solde - total_price < self.minimum_balance:
messages.error(
request,
_("Your balance is too low for this operation.")
@ -106,7 +106,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
balance.
"""
return (
float(user.solde) - float(price) >= self.minimum_balance,
user.solde - price >= self.minimum_balance,
_("Your balance is too low for this operation.")
)