Skip to content
Extraits de code Groupes Projets

Ajout de la date de fin de formation

4 files
+ 55
3
Comparer les modifications
  • Côte à côte
  • En ligne

Fichiers

+ 22
2
@@ -104,13 +104,17 @@ class CgscopFormCoopDemande(models.Model):
formation_desc = fields.Text(
string="Description de la formation",
)
formation_date = fields.Date(
string="Date de la formation",
string="Date formation (1er jour)",
default=fields.Date.today(),
index=True,
tracking=1,
)
formation_date_end = fields.Date(
string="Date formation (dernier jour)",
index=True,
tracking=1,
)
formation_nb_jours = fields.Integer(
string="Nombre de jours de formation",
)
@@ -216,6 +220,22 @@ class CgscopFormCoopDemande(models.Model):
)
)
@api.constrains("formation_date", "formation_date_end")
def _check_formation_date(self):
"""
Montant accpted <= montant formation
"""
for rec in self:
if rec.formation_date and \
rec.formation_date_end and \
rec.formation_date > rec.formation_date_end:
raise exceptions.ValidationError(
_(
"La date de fin de formation doit être supérieure ou égale"
" à la date de début de formation"
)
)
# adresse mail valide
@api.constrains("contact_mail")
def _check_contact_mail(self):
Chargement en cours