Verification du statut avant la creation d'un contrat

This commit is contained in:
2026-04-30 13:28:57 +02:00
committed by Soriba SYLLA
parent fcfac71026
commit f6b90e7dd0
269 changed files with 44845 additions and 2 deletions

36
gestion_conge/models.py Normal file
View File

@@ -0,0 +1,36 @@
import pandas as pd
from django.db import models
from gestion_employe.models import Employe
class Conge(models.Model):
"""Modèle de création des congés"""
TYPE_CHOICES = [
# ('maladie', 'Maladie'),
('conge_annuel', 'Conge Annuel'),
# ('conge_maternite', 'Conge Maternité'),
# ('conge_mariage', 'Conge Mariage'),
# ('conge_naissance', 'Conge de Naissance'),
# ('conge_deces_proche', 'Conge de décès d\'un proche'),
# ('conge_mariage_proche', 'Conge de mariage d\'un proche'),
# ('autre', 'Autre'),
]
employe = models.ForeignKey(
Employe,
on_delete=models.CASCADE,
related_name="employe"
)
date_debut = models.DateField(verbose_name='Date de Début')
date_fin = models.DateField(verbose_name='Date de Fin')
type = models.CharField(max_length=100, choices=TYPE_CHOICES, verbose_name='Type de Congé')
date_demande = models.DateField(auto_now_add=True, verbose_name="Date de Demande")
validation_hierarchique = models.BooleanField(default=None, null=True)
validation_direction = models.BooleanField(default=None, null=True)
motif_refus = models.TextField(blank=True, null=True)
@property
def nombre_jours(self):
if self.date_debut and self.date_fin:
jours = pd.bdate_range(start=self.date_debut, end=self.date_fin)
return len(jours)