date range filter
[auf_rh_dae.git] / project / rh / admin.py
1 # -*- encoding: utf-8 -*-
2
3 from collections import defaultdict
4 import datetime
5
6 from django.db import models
7 from django import forms
8 from django.core.urlresolvers import reverse
9 from django.contrib import admin
10 from django.contrib.admin.views.main import ChangeList as DjangoChangeList
11 from django.conf import settings
12 from django.db.models import Q
13 from django.template.defaultfilters import date
14 from ajax_select import make_ajax_form
15 from auf.django.metadata.admin import AUFMetadataAdminMixin, AUFMetadataInlineAdminMixin, AUF_METADATA_READONLY_FIELDS
16 from forms import ContratForm, AyantDroitForm, EmployeAdminForm, AjaxSelect
17 from dae.utils import get_employe_from_user
18 from groups import grp_drh
19 import models as rh
20 import filters
21
22
23
24 class ChangeList(DjangoChangeList):
25
26 def __init__(self, *args, **kwargs):
27 super(ChangeList, self).__init__(*args, **kwargs)
28
29 def get_query_set(self):
30 old = self.params.copy()
31 date_debut = None
32 date_fin = None
33 for k, v in self.params.items():
34 if k.startswith('date_debut'):
35 date_debut = v
36 del self.params[k]
37 elif k.startswith('date_fin'):
38 date_fin = v
39 del self.params[k]
40
41 qs = super(ChangeList, self).get_query_set()
42
43 if date_fin is None and date_debut is not None:
44 date_fin = date_debut
45 if date_debut is None and date_fin is not None:
46 date_debut = date_fin
47
48 if date_debut is not None and date_fin is not None:
49 q_left = (Q(date_debut__isnull=True) | Q(date_debut__lte=date_debut)) & (Q(date_fin__gte=date_debut) & Q(date_fin__lte=date_fin))
50 q_right = (Q(date_fin__isnull=True) | Q(date_fin__gte=date_fin)) & (Q(date_debut__gte=date_debut) & Q(date_debut__lte=date_fin))
51 q_both = Q(date_fin__isnull=True) | Q(date_fin__gte=date_fin) & (Q(date_debut__isnull=True) | Q(date_debut__lte=date_debut))
52 qs = qs.filter(q_left | q_right | q_both)
53
54
55
56 self.params = old
57 return qs
58
59 # Override of the InlineModelAdmin to support the link in the tabular inline
60 class LinkedInline(admin.options.InlineModelAdmin):
61 template = "admin/linked.html"
62 admin_model_path = None
63
64 def __init__(self, *args):
65 super(LinkedInline, self).__init__(*args)
66 if self.admin_model_path is None:
67 self.admin_model_path = self.model.__name__.lower()
68
69
70 class ProtectRegionMixin(object):
71
72 def queryset(self, request):
73 from dae.workflow import grp_drh, grp_correspondants_rh
74 qs = super(ProtectRegionMixin, self).queryset(request)
75
76 if request.user.is_superuser:
77 return qs
78
79 user_groups = request.user.groups.all()
80
81 if grp_drh in user_groups:
82 return qs
83
84 if grp_correspondants_rh in user_groups:
85 employe = get_employe_from_user(request.user)
86 q = Q(**{self.model.prefix_implantation: employe.implantation.region})
87 qs = qs.filter(q).distinct()
88 return qs
89 return qs.none()
90
91 def has_change_permission(self, request, obj=None):
92 user_groups = request.user.groups.all()
93
94 # Lock pour autoriser uniquement les DRH à utiliser RH
95 if not request.user.is_superuser and not grp_drh in user_groups:
96 return False
97
98 if len(user_groups) == 0 and not request.user.is_superuser:
99 return False
100
101 if obj is None:
102 return True
103 ids = [o.id for o in self.queryset(request)]
104 return obj.id in ids
105
106
107 # Inlines
108
109 class ReadOnlyInlineMixin(object):
110 def get_readonly_fields(self, request, obj=None):
111 return [f.name for f in self.model._meta.fields if f.name not in AUF_METADATA_READONLY_FIELDS]
112
113
114 class AyantDroitInline(AUFMetadataInlineAdminMixin, admin.StackedInline):
115 model = rh.AyantDroit
116 form = AyantDroitForm
117 extra = 0
118
119 fieldsets = (
120 (None, {
121 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', 'lien_parente', )
122 }),
123 )
124
125
126 class AyantDroitCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
127 readonly_fields = ('owner', )
128 model = rh.AyantDroitCommentaire
129 extra = 1
130
131
132 class ContratInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
133 form = ContratForm
134 model = rh.Contrat
135 extra = 1
136
137
138 class DossierROInline(ReadOnlyInlineMixin, LinkedInline):
139 template = "admin/rh/dossier/linked.html"
140 exclude = AUF_METADATA_READONLY_FIELDS
141 model = rh.Dossier
142 extra = 0
143 can_delete = False
144
145 def has_add_permission(self, request=None):
146 return False
147
148 def has_change_permission(self, request, obj=None):
149 return False
150
151 def has_delete_permission(self, request, obj=None):
152 return False
153
154
155 class DossierCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
156 readonly_fields = ('owner', )
157 model = rh.DossierCommentaire
158 extra = 1
159
160
161 class DossierPieceInline(admin.TabularInline):
162 model = rh.DossierPiece
163 extra = 4
164
165
166 class EmployeInline(admin.TabularInline):
167 model = rh.Employe
168
169 class EmployeCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
170 readonly_fields = ('owner', )
171 model = rh.EmployeCommentaire
172 extra = 1
173
174
175 class EmployePieceInline(admin.TabularInline):
176 model = rh.EmployePiece
177 extra = 4
178
179
180 class PosteCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
181 readonly_fields = ('owner', )
182 model = rh.PosteCommentaire
183 extra = 1
184
185
186 class PosteFinancementInline(admin.TabularInline):
187 model = rh.PosteFinancement
188
189
190 class PostePieceInline(admin.TabularInline):
191 model = rh.PostePiece
192
193
194 class RemunerationInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
195 model = rh.Remuneration
196 extra = 1
197
198
199 class RemunerationROInline(ReadOnlyInlineMixin, RemunerationInline):
200 pass
201
202
203 class TypePosteInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
204 model = rh.TypePoste
205
206
207 class PosteComparaisonInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
208 model = rh.PosteComparaison
209
210
211 class ClassementAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
212 list_display = ('_classement', 'date_modification', 'user_modification', )
213 fieldsets = AUFMetadataAdminMixin.fieldsets + (
214 (None, {
215 'fields': ('type', 'echelon', 'degre', 'coefficient', )
216 }),
217 )
218
219 def _classement(self, obj):
220 return unicode(obj)
221 _classement.short_description = u"Classement"
222
223 class CommentaireAdmin(admin.ModelAdmin):
224 pass
225
226
227 class DeviseAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
228 list_display = ('code', 'nom', 'date_modification', 'user_modification', )
229 fieldsets = AUFMetadataAdminMixin.fieldsets + (
230 (None, {
231 'fields': ('code', 'nom', ),
232 }),
233 )
234
235
236 class DossierAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
237 alphabet_filter = 'employe__nom'
238 search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin')
239 list_display = (
240 '_id',
241 '_poste',
242 '_employe',
243 '_date_debut',
244 '_date_fin',
245 'date_modification',
246 'user_modification',
247 )
248 list_filter = (
249 'poste__implantation__region',
250 'poste__implantation',
251 'poste__type_poste',
252 'poste__type_poste__famille_emploi',
253 'rh_contrats__type_contrat',
254 'date_debut',
255 'date_fin',
256 )
257 inlines = (DossierPieceInline, ContratInline,
258 RemunerationInline,
259 DossierCommentaireInline,
260 )
261 fieldsets = AUFMetadataAdminMixin.fieldsets + (
262 (None, {
263 'fields': ('employe', 'poste', 'statut', 'organisme_bstg',)
264 }),
265 ('Recrutement', {
266 'fields': ('statut_residence', 'remplacement', 'remplacement_de', )
267 }),
268 ('Rémunération', {
269 'fields': ('classement', ('regime_travail', 'regime_travail_nb_heure_semaine'),)
270 }),
271 ('Occupation du Poste par cet Employe', {
272 'fields': (('date_debut', 'date_fin'), )
273 }),
274 )
275 form = make_ajax_form(rh.Dossier, {
276 'employe' : 'employes',
277 'poste' : 'postes',
278 'remplacement_de' : 'dossiers',
279 })
280
281 def lookup_allowed(self, key, value):
282 if key in (
283 'employe__nom__istartswith',
284 'poste__implantation__region__id__exact',
285 'poste__implantation__id__exact',
286 'poste__type_poste__id__exact',
287 'poste__type_poste__famille_emploi__id__exact',
288 'rh_contrats__type_contrat__id__exact',
289 'date_debut__gte',
290 'date_debut__isnull',
291 'date_fin__lte',
292 'date_fin__isnull',
293 ):
294 return True
295
296 def get_changelist(self, request, **kwargs):
297 return ChangeList
298
299 def _id(self, d):
300 apercu_link = u"""<a title="Aperçu du dossier" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a>""" % \
301 (reverse('dossier_apercu', args=(d.id,)),
302 settings.STATIC_URL,
303 )
304 link = u"""%s&nbsp;<a href="%s" title="Modifier le dossier"><strong>%s</strong></a>""" % \
305 (apercu_link,
306 reverse('admin:rh_dossier_change', args=(d.id,)),
307 d.id,
308 )
309 return link
310 _id.allow_tags = True
311 _id.short_description = u"Dossier__#"
312 _id.admin_order_field = 'id'
313
314
315 def _date_debut(self, obj):
316 return date(obj.date_debut)
317
318 _date_debut.short_description = u'Occupation début'
319 _date_debut.admin_order_field = 'date_debut'
320
321 def _date_fin(self, obj):
322 return date(obj.date_fin)
323 _date_fin.short_description = u'Occupation fin'
324 _date_fin.admin_order_field = 'date_fin'
325
326 def _poste(self, dossier):
327 link = u"""<a title="Aperçu du poste" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a> <a href="%s" title="Modifier le poste">%s</a>""" % \
328 (reverse('poste_apercu', args=(dossier.poste.id,)),
329 settings.STATIC_URL,
330 reverse('admin:rh_poste_change', args=(dossier.poste.id,)),
331 dossier.poste,
332 )
333 return link
334 _poste.allow_tags = True
335 _poste.short_description = u'Poste'
336 _poste.admin_order_field = 'poste__nom'
337
338 def _employe(self, obj):
339 employe = obj.employe
340 view_link = reverse('employe_apercu', args=(employe.id,))
341 edit_link = reverse('admin:rh_employe_change', args=(employe.id,))
342
343 style = ""
344 view = u"""<a href="%s" title="Aperçu l'employé" onclick="return showAddAnotherPopup(this);"><img src="%simg/loupe.png" /></a>""" % (view_link, settings.STATIC_URL,)
345 return u"""%s<a href='%s' style="%s;">[%s] %s %s</a>""" % \
346 (view, edit_link, style, employe.id, employe.nom.upper(), employe.prenom.title())
347 _employe.allow_tags = True
348 _employe.short_description = u"Employé ([code] NOM Prénom)"
349 _employe.admin_order_field = "employe__nom"
350
351 def save_formset(self, request, form, formset, change):
352 instances = formset.save(commit=False)
353 for instance in instances:
354 if instance.__class__ == rh.DossierCommentaire:
355 instance.owner = request.user
356 instance.date_creation = datetime.datetime.now()
357 instance.save()
358
359
360 class DossierPieceAdmin(admin.ModelAdmin):
361 pass
362
363
364 class DossierCommentaireAdmin(admin.ModelAdmin):
365 pass
366
367
368 class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
369 alphabet_filter = 'nom'
370 DEFAULT_ALPHABET = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
371 search_fields = ('id', 'nom', 'prenom', 'nom_affichage', )
372 ordering = ('nom', )
373 form = EmployeAdminForm
374 list_display = ('_apercu', '_nom', '_dossiers', 'date_modification', 'user_modification', )
375 list_filter = ('rh_dossiers__poste__implantation__region', 'rh_dossiers__poste__implantation', 'nb_postes', )
376 inlines = (AyantDroitInline,
377 DossierROInline,
378 EmployePieceInline,
379 EmployeCommentaireInline)
380 fieldsets = AUFMetadataAdminMixin.fieldsets + (
381 ('Identification', {
382 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', )
383 }),
384 ('Informations personnelles', {
385 'fields': ('situation_famille', 'date_entree', )
386 }),
387 ('Coordonnées', {
388 'fields': (('tel_domicile', 'tel_cellulaire'), ('adresse', 'ville'), ('code_postal', 'province'), 'pays', )
389 }),
390 )
391
392 def _apercu(self, obj):
393 return u"""<a title="Aperçu de l'employé" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a>""" % \
394 (reverse('employe_apercu', args=(obj.id,)), settings.STATIC_URL)
395 _apercu.allow_tags = True
396 _apercu.short_description = u""
397 _apercu.admin_order_field = ""
398
399 def _nom(self, obj):
400 edit_link = reverse('admin:rh_employe_change', args=(obj.id,))
401 return u"""<a href='%s'><strong>[%s] %s %s</strong></a>""" % \
402 (edit_link, obj.id, obj.nom.upper(), obj.prenom.title(),)
403 _nom.allow_tags = True
404 _nom.short_description = u"Employé ([code] NOM Prénom)"
405 _nom.admin_order_field = "nom"
406
407 def _dossiers(self, obj):
408 l = []
409 for d in obj.rh_dossiers.all().order_by('-date_debut'):
410 apercu = u"""<a title="Aperçu du dossier" href="%s" onclick="return showAddAnotherPopup(this);" title="Aperçu du dossier"><img src="%simg/loupe.png" /></a>""" % \
411 (reverse('dossier_apercu', args=(d.id,)), settings.STATIC_URL,)
412 link = u"""<li>%s<a href='%s'>%s : %s</a></li>""" % \
413 (apercu,
414 reverse('admin:rh_dossier_change', args=(d.id,)),
415 d.date_debut.year,
416 d.poste,
417 )
418
419 # Dossier terminé en gris non cliquable
420 if d.date_fin is not None:
421 link = u"""<li style="color: grey">%s : %s</li>""" % \
422 (d.date_debut.year,
423 d.poste,
424 )
425
426 l.append(link)
427 return "<ul>%s</ul>" % "\n".join(l)
428 _dossiers.allow_tags = True
429 _dossiers.short_description = u"Dossiers"
430
431 def queryset(self, request):
432 qs = super(EmployeAdmin, self).queryset(request)
433 return qs.select_related(depth=1).order_by('nom')
434
435 def save_formset(self, request, form, formset, change):
436 instances = formset.save(commit=False)
437 for instance in instances:
438 if instance.__class__ == rh.EmployeCommentaire:
439 instance.owner = request.user
440 instance.date_creation = datetime.datetime.now()
441 instance.save()
442
443
444
445 class EmployeCommentaireAdmin(admin.ModelAdmin):
446 pass
447
448
449 class EmployePieceAdmin(admin.ModelAdmin):
450 pass
451
452
453 class FamilleEmploiAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
454 list_display = ('nom', 'date_modification', 'user_modification', )
455 inlines = (TypePosteInline,)
456 fieldsets = AUFMetadataAdminMixin.fieldsets + (
457 (None, {
458 'fields': ('nom', )
459 }),
460 )
461
462
463 class OrganismeBstgAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
464 search_fields = ('nom',)
465 list_display = ('nom', 'type', 'pays', 'date_modification', 'user_modification', )
466 list_filter = ('type', )
467 inlines = (DossierROInline,)
468 fieldsets = AUFMetadataAdminMixin.fieldsets + (
469 (None, {
470 'fields': ('nom', 'type', 'pays', )
471 }),
472 )
473
474
475 class PosteAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
476 form = make_ajax_form(rh.Poste, {
477 'implantation' : 'implantations',
478 'type_poste' : 'typepostes',
479 'responsable' : 'postes',
480 'valeur_point_min' : 'valeurpoints',
481 'valeur_point_max' : 'valeurpoints',
482 })
483 alphabet_filter = 'nom'
484 search_fields = ('nom',
485 'implantation__code',
486 'implantation__nom',
487 'implantation__region__code',
488 'implantation__region__nom',
489 )
490 list_display = (
491 '_apercu',
492 '_nom',
493 '_occupe_par',
494 'implantation',
495 '_service',
496 'date_debut',
497 'date_fin',
498 'date_modification',
499 'user_modification',
500 )
501 list_filter = (
502 'service',
503 'implantation__region',
504 'implantation',
505 'type_poste',
506 'type_poste__famille_emploi',
507 'date_debut',
508 'date_fin',
509 'vacant',
510 )
511 fieldsets = AUFMetadataAdminMixin.fieldsets + (
512 (None, {
513 'fields': (('nom', 'nom_feminin'), 'implantation', 'type_poste',
514 'service', 'responsable')
515 }),
516 ('Contrat', {
517 'fields': (('regime_travail', 'regime_travail_nb_heure_semaine'), )
518 }),
519 ('Recrutement', {
520 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),)
521 }),
522 ('Rémunération', {
523 'fields': (('classement_min', 'valeur_point_min', 'devise_min', 'salaire_min', 'indemn_min', 'autre_min', ),
524 ('classement_max', 'valeur_point_max' ,'devise_max', 'salaire_max', 'indemn_max', 'autre_max', ),
525 )
526 }),
527 ('Comparatifs de rémunération', {
528 'fields': ('devise_comparaison',
529 ('comp_locale_min', 'comp_locale_max'),
530 ('comp_universite_min', 'comp_universite_max'),
531 ('comp_fonctionpub_min', 'comp_fonctionpub_max'),
532 ('comp_ong_min', 'comp_ong_max'),
533 ('comp_autre_min', 'comp_autre_max'))
534 }),
535 ('Justification', {
536 'fields': ('justification',)
537 }),
538 ('Autres Méta-données', {
539 'fields': ('date_debut', 'date_fin')
540 }),
541 )
542
543 inlines = (PosteFinancementInline,
544 PostePieceInline,
545 DossierROInline,
546 PosteComparaisonInline,
547 PosteCommentaireInline, )
548
549 def lookup_allowed(self, key, value):
550 if key in (
551 'date_debut__gte',
552 'date_debut__isnull',
553 'date_fin__lte',
554 'date_fin__isnull',
555 ):
556 return True
557
558
559 def _apercu(self, poste):
560 link = u"""<a onclick="return showAddAnotherPopup(this);" title="Aperçu du poste" href='%s'><img src="%simg/loupe.png" /> %s</a>""" % \
561 (reverse('poste_apercu', args=(poste.id,)),
562 settings.STATIC_URL,
563 poste.id,
564 )
565 return link
566 _apercu.allow_tags = True
567 _apercu.short_description = 'Poste __#'
568 _apercu.admin_order_field = 'id'
569
570 def _service(self, obj):
571 return obj.service
572
573 def _nom(self, poste):
574 link = u"""<a href="%s" title="Modifier le poste"><strong>%s</strong></a>""" % \
575 (reverse('admin:rh_poste_change', args=(poste.id,)),
576 poste.nom,
577 )
578 return link
579 _nom.allow_tags = True
580 _nom.short_description = u'Nom'
581 _nom.admin_order_field = 'nom'
582
583 def _occupe_par(self, obj):
584 """Formatte la méthode Poste.occupe_par() pour l'admin"""
585 output = u"Vacant"
586 if obj.date_fin is not None and obj.date_fin < datetime.date.now():
587 return u"s/o"
588 employes = obj.occupe_par()
589 if employes:
590 l = []
591 for e in employes:
592 link = "<a href='%s' title='Aperçu de l\'employer' onclick='return showAddAnotherPopup(this)'><img src='%simg/loupe.png' /></a> <a href='%s'>%s</a>" % \
593 (reverse('employe_apercu', args=(e.id,)),
594 settings.STATIC_URL,
595 reverse('admin:rh_employe_change', args=(e.id,)),
596 e
597 )
598 l.append(link)
599 output = "\n<br />".join(l)
600 return output
601 _occupe_par.allow_tags = True
602 _occupe_par.short_description = "Occupé par"
603
604 def save_formset(self, request, form, formset, change):
605 instances = formset.save(commit=False)
606 for instance in instances:
607 if instance.__class__ == rh.PosteCommentaire:
608 instance.owner = request.user
609 instance.date_creation = datetime.datetime.now()
610 instance.save()
611 formset.save_m2m()
612
613
614 class PosteCommentaireAdmin(admin.ModelAdmin):
615 pass
616
617
618 class PosteFinancementAdmin(admin.ModelAdmin):
619 pass
620
621
622 class PostePieceAdmin(admin.ModelAdmin):
623 fk_name = 'poste'
624
625
626 class RemunerationAdmin(admin.ModelAdmin):
627 pass
628
629
630 class ResponsableImplantationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
631 fieldsets = AUFMetadataAdminMixin.fieldsets + (
632 (None, {
633 'fields': ('employe', 'implantation', ),
634 }),
635 )
636
637
638 class ServiceAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
639 list_display = ('nom', 'date_modification', 'user_modification', )
640 fieldsets = AUFMetadataAdminMixin.fieldsets + (
641 (None, {
642 'fields': ('nom', ),
643 }),
644 )
645
646 class StatutAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
647 list_display = ('code', 'nom', 'date_modification', 'user_modification', )
648 fieldsets = AUFMetadataAdminMixin.fieldsets + (
649 (None, {
650 'fields': ('code', 'nom', ),
651 }),
652 )
653
654 class TauxChangeAdmin(admin.ModelAdmin):
655 list_display = ('taux', 'devise', 'annee', 'date_modification', 'user_modification', )
656 list_filter = ('devise', )
657 fieldsets = AUFMetadataAdminMixin.fieldsets + (
658 (None, {
659 'fields': ('taux', 'devise', 'annee', ),
660 }),
661 )
662
663 class TypeContratAdmin(admin.ModelAdmin):
664 list_display = ('nom', 'nom_long', 'date_modification', 'user_modification', )
665 fieldsets = AUFMetadataAdminMixin.fieldsets + (
666 (None, {
667 'fields': ('nom', 'nom_long', ),
668 }),
669 )
670
671
672 class TypePosteAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
673 search_fields = ('nom', 'nom_feminin', )
674 list_display = ('nom', 'famille_emploi', 'date_modification', 'user_modification', )
675 list_filter = ('famille_emploi', )
676 fieldsets = AUFMetadataAdminMixin.fieldsets + (
677 (None, {
678 'fields': ('nom', 'nom_feminin', 'is_responsable', 'famille_emploi', )
679 }),
680 )
681
682
683 class TypeRemunerationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
684 list_display = ('nom', 'type_paiement', 'nature_remuneration', 'date_modification', 'user_modification', )
685 fieldsets = AUFMetadataAdminMixin.fieldsets + (
686 (None, {
687 'fields': ('nom', 'type_paiement', 'nature_remuneration', )
688 }),
689 )
690
691
692 class TypeRevalorisationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
693 list_display = ('nom', 'date_modification', 'user_modification', )
694 fieldsets = AUFMetadataAdminMixin.fieldsets + (
695 (None, {
696 'fields': ('nom', )
697 }),
698 )
699
700
701 class ValeurPointAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
702 list_display = ('_devise_code', '_devise_nom', 'annee', 'valeur', 'date_modification', 'user_modification', )
703 list_filter = ('annee', 'devise', )
704 fieldsets = AUFMetadataAdminMixin.fieldsets + (
705 (None, {
706 'fields': ('valeur', 'devise', 'implantation', 'annee', )
707 }),
708 )
709
710 def _devise_code(self, obj):
711 return obj.devise.code
712 _devise_code.short_description = "Code de la devise"
713
714 def _devise_nom(self, obj):
715 return obj.devise.nom
716 _devise_nom.short_description = "Nom de la devise"
717
718
719 admin.site.register(rh.Classement, ClassementAdmin)
720 admin.site.register(rh.Devise, DeviseAdmin)
721 admin.site.register(rh.Dossier, DossierAdmin)
722 admin.site.register(rh.Employe, EmployeAdmin)
723 admin.site.register(rh.FamilleEmploi, FamilleEmploiAdmin)
724 admin.site.register(rh.OrganismeBstg, OrganismeBstgAdmin)
725 admin.site.register(rh.Poste, PosteAdmin)
726 admin.site.register(rh.ResponsableImplantation, ResponsableImplantationAdmin)
727 admin.site.register(rh.Service, ServiceAdmin)
728 admin.site.register(rh.Statut, StatutAdmin)
729 admin.site.register(rh.TauxChange, TauxChangeAdmin)
730 admin.site.register(rh.TypeContrat, TypeContratAdmin)
731 admin.site.register(rh.TypePoste, TypePosteAdmin)
732 admin.site.register(rh.TypeRemuneration, TypeRemunerationAdmin)
733 admin.site.register(rh.TypeRevalorisation, TypeRevalorisationAdmin)
734 admin.site.register(rh.ValeurPoint, ValeurPointAdmin)