id=instance.id)
dd = instance.date_debut
df = instance.date_fin
+ today = date.today()
# Here, verify differences between the instance, before and
# after the save.
Q(date_fin__gte=dd - NEW_EMPLOYE_THRESHOLD)
)
- # 1. If existe un Dossier récent, et c'est une nouvelle
- # instance de Dossier:
+ # 1. If existe un Dossier récent
if exists_recent_file_qs.count() > 0:
cls.create_changement(
instance,
instance,
'NO',
)
-
+
+ elif not df and not created and cls.objects.filter(
+ valide=True,
+ date_creation__gte=today - NEW_EMPLOYE_THRESHOLD,
+ type='DE',
+ ).count() > 0:
+ cls.create_changement(
+ instance,
+ 'MO',
+ )
# Date de fin a été modifiée:
if df_has_changed: