Commit 5c8e90fd authored by Maxime Bombar's avatar Maxime Bombar

[cotisations] Replace Float by Decimal everywhere

parent f6dc63aa
...@@ -233,7 +233,7 @@ class RechargeForm(FormRevMixin, Form): ...@@ -233,7 +233,7 @@ class RechargeForm(FormRevMixin, Form):
""" """
Form used to refill a user's balance Form used to refill a user's balance
""" """
value = forms.FloatField( value = forms.DecimalField(
label=_("Amount"), label=_("Amount"),
min_value=0.01, min_value=0.01,
validators=[] validators=[]
......
...@@ -83,7 +83,7 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): ...@@ -83,7 +83,7 @@ class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
).aggregate( ).aggregate(
total=models.Sum( total=models.Sum(
models.F('prix')*models.F('number'), models.F('prix')*models.F('number'),
output_field=models.FloatField() output_field=models.DecimalField()
) )
)['total'] or 0 )['total'] or 0
......
...@@ -73,7 +73,7 @@ class BalancePayment(PaymentMethodMixin, models.Model): ...@@ -73,7 +73,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
""" """
user = invoice.user user = invoice.user
total_price = invoice.prix_total() 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( messages.error(
request, request,
_("Your balance is too low for this operation.") _("Your balance is too low for this operation.")
...@@ -106,7 +106,7 @@ class BalancePayment(PaymentMethodMixin, models.Model): ...@@ -106,7 +106,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
balance. balance.
""" """
return ( return (
float(user.solde) - float(price) >= self.minimum_balance, user.solde - price >= self.minimum_balance,
_("Your balance is too low for this operation.") _("Your balance is too low for this operation.")
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment