form = DossierForm
alphabet_filter = 'employe__nom'
search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin')
- list_display = ('_employe', '_poste', 'date_debut', 'date_fin', 'date_modification', '_actif')
- list_filter = ('poste__implantation__region', 'poste__implantation', 'actif', )
+ list_display = ('_id', '_employe', '_actif', '_poste', 'date_debut', 'date_fin', 'date_modification')
+ list_filter = ('poste__implantation__region', 'poste__implantation', 'date_debut', 'date_fin', )
inlines = (DossierPieceInline, ContratInline,
RemunerationInline,
#EvenementInline,
js = ('js/dossier.js',)
def lookup_allowed(self, key, value):
- if key in ('employe__nom__istartswith', 'actif__exact', ):
+ if key in (
+ 'employe__nom__istartswith',
+ 'actif__exact',
+ 'date_fin__year',
+ 'date_fin__month',
+ 'date_fin__day',
+ 'date_debut__year',
+ 'date_debut__month',
+ 'date_debut__day',
+ ):
return True
+ def _id(self, d):
+ link = u"""<a onclick="return showAddAnotherPopup(this);" href='%s'>%s</a> <a href="%s" title="Modifier le dossier"><img src="%simg/page_edit.png" /></a>""" % \
+ (reverse('dossier_apercu', args=(d.id,)),
+ d.id,
+ reverse('admin:rh_dossier_change', args=(d.id,)),
+ settings.MEDIA_URL,
+ )
+ return link
+ _id.allow_tags = True
+ _id.short_description = u'Numéro de dossier'
+ _id.admin_order_field = 'id'
+
+
def _actif(self, dossier):
if dossier.employe.actif:
html = """<img alt="True" src="%simg/admin/icon-yes.gif">"""
else:
html = """<img alt="False" src="%simg/admin/icon-no.gif">"""
return html % settings.ADMIN_MEDIA_PREFIX
- _actif.allow_tags = u'Employé actif'
+ _actif.allow_tags = True
_actif.short_description = u'Employé actif'
_actif.admin_order_field = 'employe__actif'
def _poste(self, dossier):
- return unicode(dossier.poste.nom)
+ 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,)),
+ dossier.poste,
+ reverse('admin:rh_poste_change', args=(dossier.poste.id,)),
+ settings.MEDIA_URL,
+ )
+ return link
+ _poste.allow_tags = True
_poste.short_description = u'Poste'
_poste.admin_order_field = 'poste__nom'
- def _employe(self, dossier):
- return unicode(dossier.employe)
- _employe.short_description = u'Employé'
- _employe.admin_order_field = 'employe__nom'
+ def _employe(self, obj):
+ 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,)
+ _employe.allow_tags = True
+ _employe.short_description = u"Employé ([code] NOM Prénom)"
+ _employe.admin_order_field = "employe__nom"
def save_formset(self, request, form, formset, change):
instances = formset.save(commit=False)
'implantation__region__code',
'implantation__region__nom',
)
- list_display = ('nom',
+ list_display = (
+ '_nom',
'_occupe_par',
'implantation',
'service',
DossierROInline,
PosteCommentaireInline, )
+ def _nom(self, poste):
+ 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=(poste.id,)),
+ poste.nom,
+ reverse('admin:rh_poste_change', args=(poste.id,)),
+ settings.MEDIA_URL,
+ )
+ return link
+ _nom.allow_tags = True
+ _nom.short_description = u'Nom'
+ _nom.admin_order_field = 'nom'
+
def _occupe_par(self, obj):
"""Formatte la méthode Poste.occupe_par() pour l'admin"""
output = "VACANT"