class DossierAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
alphabet_filter = 'employe__nom'
search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin')
- list_display = ('_id', '_employe', '_actif', '_poste', 'date_debut', 'date_fin', 'date_modification')
+ list_display = (
+ '_id',
+ '_poste',
+ '_employe',
+ '_date_debut',
+ '_date_fin',
+ 'date_modification',
+ )
list_filter = (
'poste__implantation__region',
'poste__implantation',
)
return link
_id.allow_tags = True
- _id.short_description = u'Numéro de dossier'
+ _id.short_description = u'#'
_id.admin_order_field = 'id'
_actif.short_description = u'Employé actif'
_actif.admin_order_field = 'employe__actif'
+ def _date_debut(self, obj):
+ return obj.date_debut
+ _date_debut.short_description = u'Occupation début'
+ _date_debut.admin_order_field = 'date_debut'
+
+ def _date_fin(self, obj):
+ return obj.date_fin
+ _date_fin.short_description = u'Occupation fin'
+ _date_fin.admin_order_field = 'date_fin'
+
def _poste(self, dossier):
link = u"""<a onclick="return showAddAnotherPopup(this);" href='%s'>%s</a> <a href="%s" title="Modifier le poste"><img src="%simg/page_edit.png" /></a>""" % \
(reverse('poste_apercu', args=(dossier.poste.id,)),
employe = obj.employe
view_link = reverse('employe_apercu', args=(employe.id,))
edit_link = reverse('admin:rh_employe_change', args=(employe.id,))
- return u"""<a onclick="return showAddAnotherPopup(this);" href='%s'>[%s] %s %s</a>
- <a href="%s" title="Modifier l'employé"><img src="%simg/user_edit.png" /></a>""" % \
- (view_link, employe.id, employe.nom.upper(), employe.prenom.title(), edit_link, settings.MEDIA_URL,)
+
+ if employe.actif == False:
+ style = "color: grey";
+ edit = ""
+ else:
+ style = ""
+ edit = u"""<a href="%s" title="Modifier l'employé"><img src="%simg/user_edit.png" /></a>""" % (edit_link, settings.MEDIA_URL,)
+ return u"""<a onclick="return showAddAnotherPopup(this);" href='%s' style="%s;">[%s] %s %s</a>%s
+ """ % \
+ (view_link, style, employe.id, employe.nom.upper(), employe.prenom.title(), edit)
_employe.allow_tags = True
_employe.short_description = u"Employé ([code] NOM Prénom)"
_employe.admin_order_field = "employe__nom"