remove rh_v1
[auf_rh_dae.git] / project / dae / forms.py
index 1296cc9..2e33c61 100644 (file)
@@ -9,7 +9,7 @@ from auf.django.workflow.forms import WorkflowFormMixin
 from datamaster_modeles import models as ref
 from dae import models as dae
 from utils import get_employe_from_user, is_user_dans_services_centraux
-from rh_v1 import models as rh
+from rh import models as rh
 from workflow import grp_drh, POSTE_ETATS_BOUTONS
 
 def _implantation_choices(obj, request):
@@ -33,11 +33,11 @@ def _employe_choices(obj, request):
     # SERVICE
     if is_user_dans_services_centraux(request.user):
         q_dae_region_service = Q(poste__implantation=employe.implantation)
-        q_rh_region_service = Q(implantation1=employe.implantation) | Q(implantation2=employe.implantation)
+        q_rh_region_service = Q(poste__implantation=employe.implantation)
     # REGION
     else:
         q_dae_region_service = Q(poste__implantation__region=employe.implantation.region)
-        q_rh_region_service = Q(implantation1__region=employe.implantation.region) | Q(implantation2__region=employe.implantation.region)
+        q_rh_region_service = Q(poste__implantation__region=employe.implantation.region)
     # TRAITEMENT DRH
     if grp_drh in request.user.groups.all():
         q_dae_region_service = Q()
@@ -198,7 +198,7 @@ class PosteForm(forms.ModelForm):
         if self.instance and self.instance.id is None:
             dossiers = self.instance.get_dossiers()
             if len(dossiers) > 0:
-                self.initial['service'] = dossiers[0].service_id
+                self.initial['service'] = dossiers[0].poste.service
                 self.initial['nom'] = "%s %s" % (self.initial['nom'], self.instance.get_complement_nom())