feat: Ajout de la sélection des modes de paiements / refactoring de

l'automate
This commit is contained in:
N3WT DE COMPET
2025-04-06 20:45:41 +02:00
parent 9559db59eb
commit 5a7661db93
19 changed files with 286 additions and 190 deletions

View File

@ -3,7 +3,7 @@ from django.utils.timezone import now
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from School.models import SchoolClass, Fee, Discount
from School.models import SchoolClass, Fee, Discount, PaymentModeType
from Auth.models import ProfileRole
from Establishment.models import Establishment
@ -62,11 +62,6 @@ class Student(models.Model):
MS = 3, _('MS - Moyenne Section')
GS = 4, _('GS - Grande Section')
class PaymentMethod(models.IntegerChoices):
NONE = 0, _('Sélection du mode de paiement')
SEPA_DIRECT_DEBIT = 1, _('Prélèvement SEPA')
CHECK = 2, _('Chèques')
last_name = models.CharField(max_length=200, default="")
first_name = models.CharField(max_length=200, default="")
gender = models.IntegerField(choices=StudentGender, default=StudentGender.NONE, blank=True)
@ -77,7 +72,6 @@ class Student(models.Model):
birth_place = models.CharField(max_length=200, default="", blank=True)
birth_postal_code = models.IntegerField(default=0, blank=True)
attending_physician = models.CharField(max_length=200, default="", blank=True)
payment_method = models.IntegerField(choices=PaymentMethod, default=PaymentMethod.NONE, blank=True)
# Many-to-Many Relationship
profiles = models.ManyToManyField('Auth.Profile', blank=True)
@ -184,17 +178,18 @@ class RegistrationTemplateMaster(models.Model):
class RegistrationForm(models.Model):
class RegistrationFormStatus(models.IntegerChoices):
RF_ABSENT = 0, _('Pas de dossier d\'inscription')
RF_CREATED = 1, _('Dossier d\'inscription créé')
RF_IDLE = 0, _('Pas de dossier d\'inscription')
RF_INITIALIZED = 1, _('Dossier d\'inscription initialisé')
RF_SENT = 2, _('Dossier d\'inscription envoyé')
RF_UNDER_REVIEW = 3, _('Dossier d\'inscription en cours de validation')
RF_TO_BE_FOLLOWED_UP = 4, _('Dossier d\'inscription à relancer')
RF_VALIDATED = 5, _('Dossier d\'inscription validé')
RF_ARCHIVED = 6, _('Dossier d\'inscription archivé')
RF_SEPA_SENT = 7, _('Mandat SEPA envoyé')
# One-to-One Relationship
student = models.OneToOneField(Student, on_delete=models.CASCADE, primary_key=True)
status = models.IntegerField(choices=RegistrationFormStatus, default=RegistrationFormStatus.RF_ABSENT)
status = models.IntegerField(choices=RegistrationFormStatus, default=RegistrationFormStatus.RF_IDLE)
last_update = models.DateTimeField(auto_now=True)
notes = models.CharField(max_length=200, blank=True)
registration_link_code = models.CharField(max_length=200, default="", blank=True)
@ -217,6 +212,8 @@ class RegistrationForm(models.Model):
blank=True)
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='register_forms')
registration_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
tuition_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
def __str__(self):
return "RF_" + self.student.last_name + "_" + self.student.first_name