Fix
[auf_rh_dae.git] / project / dae / views.py
index c0c0c7c..b7a7ff0 100644 (file)
@@ -895,6 +895,14 @@ def dossier(request, poste_key, employe_key):
         employe = employe_rh
 
     dossier_form = DossierForm(initial=data, instance=dossier)
+
+    if poste_rh:
+        dossier_form.fields['employe_anterieur'].queryset = (
+            dossier_form.fields['employe_anterieur'].queryset.filter(
+                rh_dossiers__poste__pk=poste_rh.pk,
+                ).distinct()
+            )
+
     vars = dict(form=dossier_form, poste=poste, employe=employe)
     return render(request, 'dae/embauche-dossier.html', vars)