From a405983cfadef756acf61f86c92d351884892076 Mon Sep 17 00:00:00 2001 From: Yoann PIETRI Date: Thu, 11 Jan 2018 19:25:41 +0100 Subject: [PATCH] Users can pay their own cotisation with their solde. --- preferences/forms.py | 1 + preferences/models.py | 4 ++++ preferences/templates/preferences/display_preferences.html | 4 ++++ users/templates/users/profil.html | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/preferences/forms.py b/preferences/forms.py index fc214f52..6d6414c3 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -51,6 +51,7 @@ class EditOptionalUserForm(ModelForm): self.fields['max_solde'].label = 'Solde maximum' self.fields['min_online_payment'].label = 'Montant de rechargement minimum en ligne' self.fields['self_adhesion'].label = 'Auto inscription' + self.fields['max_recharge'].label = 'Rechargement max' class EditOptionalMachineForm(ModelForm): diff --git a/preferences/models.py b/preferences/models.py index d4ef9645..d49a074f 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -52,6 +52,10 @@ class OptionalUser(models.Model): max_digits=5, decimal_places=2, default=10 + max_recharge = models.DecimalField( + max_digits=5, + decimal_places=2, + default=100 ) gpg_fingerprint = models.BooleanField(default=True) all_can_create = models.BooleanField( diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index e46564a3..9f958d72 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -56,6 +56,10 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ useroptions.all_can_create }} Auto inscription {{ useroptions.self_adhesion }} + {% if useroptions.user_solde %} + Rechargement max + {{ useroptions.max_recharge }} + {% endif %} {% if useroptions.user_solde %} diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 8d72b983..0b6c6f94 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -196,7 +196,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

Aucune machine

{% endif %}

Cotisations

-

{% can_create Facture %} Ajouter une cotisation {% if user_solde %} Modifier le solde{% endif%}{% acl_else %}{% if user_solde %} Ajouter une cotisation par solde{% endif %}{% acl_end %}

+

{% can_create Facture %} Ajouter une cotisation {% if user_solde %} Modifier le solde{% endif%}{% acl_else %}{% if user_solde %} Ajouter une cotisation par solde{% endif }{% acl_end %}

{% if facture_list %} {% include "cotisations/aff_cotisations.html" with facture_list=facture_list %} {% else %}