From 4944936725bf4625d988af303b43fb4ba3f780a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Larchev=C3=AAque?= Date: Fri, 5 Aug 2011 19:09:39 -0400 Subject: [PATCH] #1883 --- buildout.cfg | 1 + project/rh/lib.py | 21 +++++++++++++++++---- project/rh/models.py | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index 94ca6e9..ec769a8 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -46,6 +46,7 @@ django = 1.2.5 south = 0.7 auf.django.skin = 0.15dev auf.django.auth = 0.5.5dev +auf.django.metadata = 0.2dev django-reversion = 1.3.3 auf.django.workflow = 0.14dev django-ajax-selects = 1.1.4 diff --git a/project/rh/lib.py b/project/rh/lib.py index 0df33fc..1d7098b 100644 --- a/project/rh/lib.py +++ b/project/rh/lib.py @@ -2,6 +2,7 @@ from django.db import models from django.contrib import admin +from django.conf import settings from auf.django.metadata.admin import AUFMetadataAdminMixin, AUFMetadataInlineAdminMixin, AUF_METADATA_READONLY_FIELDS from project.rh import models as rh @@ -144,7 +145,6 @@ class ClassementAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): ) - class CommentaireAdmin(admin.ModelAdmin): pass @@ -179,7 +179,7 @@ class DeviseAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): class DossierAdmin(AUFMetadataAdminMixin, admin.ModelAdmin,): alphabet_filter = 'employe__nom' search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin') - list_display = ('_employe', '_poste', 'date_debut', 'date_fin', ) + list_display = ('_employe', '_poste', 'date_debut', 'date_fin', '_actif') inlines = (DossierPieceInline, ContratInline, RemunerationInline, #EvenementInline, @@ -201,9 +201,18 @@ class DossierAdmin(AUFMetadataAdminMixin, admin.ModelAdmin,): ) def lookup_allowed(self, key, value): - if key in ('employe__nom__istartswith', ): + if key in ('employe__nom__istartswith', 'actif__exact', ): return True + def _actif(self, dossier): + if dossier.employe.actif: + html = """True""" + else: + html = """False""" + return html % settings.ADMIN_MEDIA_PREFIX + _actif.allow_tags = u'Employé actif' + _actif.short_description = u'Employé actif' + _actif.admin_order_field = 'employe__actif' def _poste(self, dossier): return unicode(dossier.poste.nom) @@ -232,7 +241,11 @@ class DossierCommentaireAdmin(admin.ModelAdmin): class EmployeAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): alphabet_filter = 'nom' - search_fields = ('id', 'nom', 'prenom', 'nom_affichage', ) + search_fields = ('id', 'nom', 'prenom', 'nom_affichage', 'actif', ) + list_filter = ('actif', ) + ordering = ('nom', ) + actions = ('desactiver', ) + list_display = ('nom', 'prenom', 'actif', ) inlines = (AyantDroitInline, DossierROInline, EmployePieceInline, diff --git a/project/rh/models.py b/project/rh/models.py index 91c648d..5fd589f 100644 --- a/project/rh/models.py +++ b/project/rh/models.py @@ -489,7 +489,7 @@ class Dossier_(AUFMetadata): class Meta: abstract = True - ordering = ['employe__nom_affichage', 'employe__nom', 'poste__nom'] + ordering = ['employe__nom', ] verbose_name = "Dossier" verbose_name_plural = "Dossiers" -- 1.7.10.4