validation WF poste + dossier
[auf_rh_dae.git] / project / dae / forms.py
index c1c02f0..80b2774 100644 (file)
@@ -3,6 +3,7 @@
 from django import forms
 from django.forms.models import inlineformset_factory
 from django.contrib.admin import widgets as admin_widgets 
+from ajax_select.fields import AutoCompleteSelectField
 from auf.django.workflow.forms import WorkflowFormMixin
 from datamaster_modeles import models as ref
 
@@ -67,18 +68,6 @@ class JustificationAutreEmployeForm(inlineformset_factory(dae.Dossier,
                 j.save()
         super(self.__class__, self).__init__(*args, **kwargs)
 
-class PosteValidationForm(forms.ModelForm):
-    """ Validation d'un poste"""
-    class Meta:
-        model = dae.Poste
-        fields = (
-            'validation_bureau_regional',
-            'validation_drh',
-            'validation_secretaire_general',
-            'validation_recteur',
-            )    
-
-from ajax_select.fields import AutoCompleteSelectField
 class PosteForm(WorkflowFormMixin):
     """ Formulaire des postes. """
     
@@ -239,17 +228,33 @@ class EmployeForm(forms.ModelForm):
         id_copies = [p.id_rh_id for p in copies.all()]
         rhv1 = rh.Employe.objects.exclude(id__in=id_copies)
 
+        def option_label(employe):
+            return "%s %s" % (employe.nom.upper(), employe.prenom.title())
+
         return [('', 'Nouvel employé')] + \
-               sorted([('dae-%s' % p.id, unicode(p)) for p in dae_ | copies] +
-                      [('rh-%s' % p.id, unicode(p)) for p in rhv1],
+               sorted([('dae-%s' % p.id, option_label(p)) for p in dae_ | copies] +
+                      [('rh-%s' % p.id, option_label(p)) for p in rhv1],
                       key=lambda t: t[1])
 
 
 class DossierForm(forms.ModelForm):
     """ Formulaire des dossiers. """
     class Meta:
+        exclude= ('etat', )
         model = dae.Dossier
         widgets = dict(statut_residence=forms.RadioSelect(),
                        contrat_date_debut=admin_widgets.AdminDateWidget(),
                        contrat_date_fin=admin_widgets.AdminDateWidget(),
                     )
+
+class PosteWorkflowForm(WorkflowFormMixin):
+    
+    class Meta:
+        fields = ('etat', )
+        model = dae.Poste
+
+class DossierWorkflowForm(WorkflowFormMixin):
+    
+    class Meta:
+        fields = ('etat', )
+        model = dae.Dossier