id harmonisation
[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.conf import settings
11 from django.db.models import Q
12 from django.template.defaultfilters import date
13 from ajax_select import make_ajax_form
14 from auf.django.metadata.admin import AUFMetadataAdminMixin, AUFMetadataInlineAdminMixin, AUF_METADATA_READONLY_FIELDS
15 from forms import ContratForm, AyantDroitForm, EmployeAdminForm, AjaxSelect
16 from dae.utils import get_employe_from_user
17 import models as rh
18
19 # Override of the InlineModelAdmin to support the link in the tabular inline
20 class LinkedInline(admin.options.InlineModelAdmin):
21 template = "admin/linked.html"
22 admin_model_path = None
23
24 def __init__(self, *args):
25 super(LinkedInline, self).__init__(*args)
26 if self.admin_model_path is None:
27 self.admin_model_path = self.model.__name__.lower()
28
29
30 class ProtectRegionMixin(object):
31
32 def queryset(self, request):
33 from dae.workflow import grp_drh, grp_correspondants_rh
34 qs = super(ProtectRegionMixin, self).queryset(request)
35
36 if request.user.is_superuser:
37 return qs
38
39 user_groups = request.user.groups.all()
40
41 if grp_drh in user_groups:
42 return qs
43
44 if grp_correspondants_rh in user_groups:
45 employe = get_employe_from_user(request.user)
46 q = Q(**{self.model.prefix_implantation: employe.implantation.region})
47 qs = qs.filter(q).distinct()
48 return qs
49 return qs.none()
50
51 def has_change_permission(self, request, obj=None):
52 if obj is None:
53 return True
54 ids = [o.id for o in self.queryset(request)]
55 return obj.id in ids
56
57
58 # Inlines
59
60 class ReadOnlyInlineMixin(object):
61 def get_readonly_fields(self, request, obj=None):
62 return [f.name for f in self.model._meta.fields if f.name not in AUF_METADATA_READONLY_FIELDS]
63
64
65 class AyantDroitInline(AUFMetadataInlineAdminMixin, admin.StackedInline):
66 model = rh.AyantDroit
67 form = AyantDroitForm
68 extra = 0
69
70 fieldsets = (
71 (None, {
72 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', 'lien_parente', )
73 }),
74 )
75
76
77 class AyantDroitCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
78 readonly_fields = ('owner', )
79 model = rh.AyantDroitCommentaire
80 extra = 1
81
82
83 class ContratInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
84 form = ContratForm
85 model = rh.Contrat
86 extra = 1
87
88
89 class DossierROInline(ReadOnlyInlineMixin, LinkedInline):
90 template = "admin/rh/dossier/linked.html"
91 exclude = AUF_METADATA_READONLY_FIELDS
92 model = rh.Dossier
93 extra = 0
94 can_delete = False
95
96 def has_add_permission(self, request=None):
97 return False
98
99 def has_change_permission(self, request, obj=None):
100 return False
101
102 def has_delete_permission(self, request, obj=None):
103 return False
104
105
106 class DossierCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
107 readonly_fields = ('owner', )
108 model = rh.DossierCommentaire
109 extra = 1
110
111
112 class DossierPieceInline(admin.TabularInline):
113 model = rh.DossierPiece
114 extra = 4
115
116
117 class EmployeInline(admin.TabularInline):
118 model = rh.Employe
119
120 class EmployeCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
121 readonly_fields = ('owner', )
122 model = rh.EmployeCommentaire
123 extra = 1
124
125
126 class EmployePieceInline(admin.TabularInline):
127 model = rh.EmployePiece
128 extra = 4
129
130
131 class PosteCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
132 readonly_fields = ('owner', )
133 model = rh.PosteCommentaire
134 extra = 1
135
136
137 class PosteFinancementInline(admin.TabularInline):
138 model = rh.PosteFinancement
139
140
141 class PostePieceInline(admin.TabularInline):
142 model = rh.PostePiece
143
144
145 class RemunerationInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
146 model = rh.Remuneration
147 extra = 1
148
149
150 class RemunerationROInline(ReadOnlyInlineMixin, RemunerationInline):
151 pass
152
153
154 class TypePosteInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
155 model = rh.TypePoste
156
157
158 class PosteComparaisonInline(AUFMetadataInlineAdminMixin, admin.TabularInline):
159 model = rh.PosteComparaison
160
161 class AyantDroitAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
162 """
163 L'ajout d'un nouvel ayantdroit se fait dans l'admin de l'employé.
164 """
165 alphabet_filter = 'nom'
166 search_fields = ('nom', 'prenom', 'employe__nom', 'employe__prenom', )
167 list_display = ('_employe', 'lien_parente', '_ayantdroit', )
168 inlines = (AyantDroitCommentaireInline,)
169 readonly_fields = AUFMetadataAdminMixin.readonly_fields + ('employe',)
170 fieldsets = AUFMetadataAdminMixin.fieldsets + (
171 ("Lien avec l'employé", {
172 'fields': (('employe', 'lien_parente'), )
173 }),
174
175 ('Identification', {
176 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', )
177 }),
178 )
179
180 def save_formset(self, request, form, formset, change):
181 instances = formset.save(commit=False)
182 for instance in instances:
183 if instance.__class__ == rh.AyantDroitCommentaire:
184 instance.owner = request.user
185 instance.save()
186
187 def _ayantdroit(self, obj):
188 return unicode(obj)
189 _ayantdroit.short_description = u'Ayant droit'
190
191 def _employe(self, obj):
192 return unicode(obj.employe)
193 _employe.short_description = u'Employé'
194
195 def has_add_permission(self, request):
196 return False
197
198 class AyantDroitCommentaireAdmin(admin.ModelAdmin):
199 pass
200
201
202 class ClassementAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
203 list_display = ('_classement', 'date_modification', 'user_modification', )
204 fieldsets = AUFMetadataAdminMixin.fieldsets + (
205 (None, {
206 'fields': ('type', 'echelon', 'degre', 'coefficient', )
207 }),
208 )
209
210 def _classement(self, obj):
211 return unicode(obj)
212 _classement.short_description = u"Classement"
213
214 class CommentaireAdmin(admin.ModelAdmin):
215 pass
216
217
218 class DeviseAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
219 list_display = ('code', 'nom', 'date_modification', 'user_modification', 'actif', )
220 fieldsets = AUFMetadataAdminMixin.fieldsets + (
221 (None, {
222 'fields': ('code', 'nom', ),
223 }),
224 )
225
226
227 class DossierAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
228 alphabet_filter = 'employe__nom'
229 search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin')
230 list_display = (
231 '_id',
232 '_poste',
233 '_employe',
234 '_date_debut',
235 '_date_fin',
236 'date_modification',
237 'user_modification',
238 'actif',
239 )
240 list_filter = (
241 'poste__implantation__region',
242 'poste__implantation',
243 'poste__type_poste',
244 'poste__type_poste__famille_emploi',
245 'rh_contrats__type_contrat',
246 'actif',
247 )
248 inlines = (DossierPieceInline, ContratInline,
249 RemunerationInline,
250 DossierCommentaireInline,
251 )
252 fieldsets = AUFMetadataAdminMixin.fieldsets + (
253 (None, {
254 'fields': ('employe', 'poste', 'statut', 'organisme_bstg',)
255 }),
256 ('Recrutement', {
257 'fields': ('statut_residence', 'remplacement', 'remplacement_de', )
258 }),
259 ('Rémunération', {
260 'fields': ('classement', ('regime_travail', 'regime_travail_nb_heure_semaine'),)
261 }),
262 ('Occupation du Poste par cet Employe', {
263 'fields': (('date_debut', 'date_fin'), )
264 }),
265 )
266 form = make_ajax_form(rh.Dossier, {
267 'employe' : 'employes',
268 'poste' : 'postes',
269 'remplacement_de' : 'dossiers',
270 })
271
272 def lookup_allowed(self, key, value):
273 if key in (
274 'employe__nom__istartswith',
275 'actif__exact',
276 'poste__implantation__region__id__exact',
277 'poste__implantation__id__exact',
278 'poste__type_poste__id__exact',
279 'poste__type_poste__famille_emploi__id__exact',
280 'rh_contrats__type_contrat__id__exact',
281 ):
282 return True
283
284
285 def _id(self, d):
286 apercu_link = u"""<a title="Aperçu du dossier" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a>""" % \
287 (reverse('dossier_apercu', args=(d.id,)),
288 settings.STATIC_URL,
289 )
290 link = u"""%s&nbsp;<a href="%s" title="Modifier le dossier"><strong>%s</strong></a>""" % \
291 (apercu_link,
292 reverse('admin:rh_dossier_change', args=(d.id,)),
293 d.id,
294 )
295 return link
296 _id.allow_tags = True
297 _id.short_description = u"Dossier__#"
298 _id.admin_order_field = 'id'
299
300
301 def _actif(self, dossier):
302 if dossier.employe.actif:
303 html = """<img alt="True" src="%simg/admin/icon-yes.gif">"""
304 else:
305 html = """<img alt="False" src="%simg/admin/icon-no.gif">"""
306 return html % settings.ADMIN_MEDIA_PREFIX
307 _actif.allow_tags = True
308 _actif.short_description = u'Employé actif'
309 _actif.admin_order_field = 'employe__actif'
310
311 def _date_debut(self, obj):
312 return date(obj.date_debut)
313
314 _date_debut.short_description = u'Occupation début'
315 _date_debut.admin_order_field = 'date_debut'
316
317 def _date_fin(self, obj):
318 return date(obj.date_fin)
319 _date_fin.short_description = u'Occupation fin'
320 _date_fin.admin_order_field = 'date_fin'
321
322 def _poste(self, dossier):
323 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>""" % \
324 (reverse('poste_apercu', args=(dossier.poste.id,)),
325 settings.STATIC_URL,
326 reverse('admin:rh_poste_change', args=(dossier.poste.id,)),
327 dossier.poste,
328 )
329 return link
330 _poste.allow_tags = True
331 _poste.short_description = u'Poste'
332 _poste.admin_order_field = 'poste__nom'
333
334 def _employe(self, obj):
335 employe = obj.employe
336 view_link = reverse('employe_apercu', args=(employe.id,))
337 edit_link = reverse('admin:rh_employe_change', args=(employe.id,))
338
339 if employe.actif == False:
340 style = "color: grey";
341 view = ""
342 else:
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', 'actif',)
375 list_filter = ('rh_dossiers__poste__implantation__region', 'rh_dossiers__poste__implantation', 'nb_postes', 'actif', )
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', 'actif', )
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', 'actif', )
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 'actif',
501 )
502 list_filter = ('service',
503 'implantation__region',
504 'implantation',
505 'type_poste',
506 'type_poste__famille_emploi',
507 'vacant',
508 'actif',
509 )
510 fieldsets = AUFMetadataAdminMixin.fieldsets + (
511 (None, {
512 'fields': (('nom', 'nom_feminin'), 'implantation', 'type_poste',
513 'service', 'responsable')
514 }),
515 ('Contrat', {
516 'fields': (('regime_travail', 'regime_travail_nb_heure_semaine'), )
517 }),
518 ('Recrutement', {
519 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),)
520 }),
521 ('Rémunération', {
522 'fields': (('classement_min', 'valeur_point_min', 'devise_min', 'salaire_min', 'indemn_min', 'autre_min', ),
523 ('classement_max', 'valeur_point_max' ,'devise_max', 'salaire_max', 'indemn_max', 'autre_max', ),
524 )
525 }),
526 ('Comparatifs de rémunération', {
527 'fields': ('devise_comparaison',
528 ('comp_locale_min', 'comp_locale_max'),
529 ('comp_universite_min', 'comp_universite_max'),
530 ('comp_fonctionpub_min', 'comp_fonctionpub_max'),
531 ('comp_ong_min', 'comp_ong_max'),
532 ('comp_autre_min', 'comp_autre_max'))
533 }),
534 ('Justification', {
535 'fields': ('justification',)
536 }),
537 ('Autres Méta-données', {
538 'fields': ('date_debut', 'date_fin')
539 }),
540 )
541
542 inlines = (PosteFinancementInline,
543 PostePieceInline,
544 DossierROInline,
545 PosteComparaisonInline,
546 PosteCommentaireInline, )
547
548
549 def _apercu(self, poste):
550 link = u"""<a onclick="return showAddAnotherPopup(this);" title="Aperçu du poste" href='%s'><img src="%simg/loupe.png" /> %s</a>""" % \
551 (reverse('poste_apercu', args=(poste.id,)),
552 settings.STATIC_URL,
553 poste.id,
554 )
555 return link
556 _apercu.allow_tags = True
557 _apercu.short_description = 'Poste __#'
558 _apercu.admin_order_field = 'id'
559
560 def _service(self, obj):
561 return obj.service
562
563 def _nom(self, poste):
564 link = u"""<a href="%s" title="Modifier le poste"><strong>%s</strong></a>""" % \
565 (reverse('admin:rh_poste_change', args=(poste.id,)),
566 poste.nom,
567 )
568 return link
569 _nom.allow_tags = True
570 _nom.short_description = u'Nom'
571 _nom.admin_order_field = 'nom'
572
573 def _occupe_par(self, obj):
574 """Formatte la méthode Poste.occupe_par() pour l'admin"""
575 output = u"Vacant"
576 if obj.actif is False:
577 return u"s/o"
578 employes = obj.occupe_par()
579 if employes:
580 l = []
581 for e in employes:
582 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>" % \
583 (reverse('employe_apercu', args=(e.id,)),
584 settings.STATIC_URL,
585 reverse('admin:rh_employe_change', args=(e.id,)),
586 e
587 )
588 l.append(link)
589 output = "\n<br />".join(l)
590 return output
591 _occupe_par.allow_tags = True
592 _occupe_par.short_description = "Occupé par"
593
594 def save_formset(self, request, form, formset, change):
595 instances = formset.save(commit=False)
596 for instance in instances:
597 if instance.__class__ == rh.PosteCommentaire:
598 instance.owner = request.user
599 instance.date_creation = datetime.datetime.now()
600 instance.save()
601 formset.save_m2m()
602
603
604 class PosteCommentaireAdmin(admin.ModelAdmin):
605 pass
606
607
608 class PosteFinancementAdmin(admin.ModelAdmin):
609 pass
610
611
612 class PostePieceAdmin(admin.ModelAdmin):
613 fk_name = 'poste'
614
615
616 class RemunerationAdmin(admin.ModelAdmin):
617 pass
618
619
620 class ResponsableImplantationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
621 fieldsets = AUFMetadataAdminMixin.fieldsets + (
622 (None, {
623 'fields': ('employe', 'implantation', ),
624 }),
625 )
626
627
628 class ServiceAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
629 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
630 fieldsets = AUFMetadataAdminMixin.fieldsets + (
631 (None, {
632 'fields': ('nom', ),
633 }),
634 )
635
636 class StatutAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
637 list_display = ('code', 'nom', 'date_modification', 'user_modification', 'actif', )
638 fieldsets = AUFMetadataAdminMixin.fieldsets + (
639 (None, {
640 'fields': ('code', 'nom', ),
641 }),
642 )
643
644 class TauxChangeAdmin(admin.ModelAdmin):
645 list_display = ('taux', 'devise', 'annee', 'date_modification', 'user_modification', )
646 list_filter = ('devise', )
647 fieldsets = AUFMetadataAdminMixin.fieldsets + (
648 (None, {
649 'fields': ('taux', 'devise', 'annee', ),
650 }),
651 )
652
653 class TypeContratAdmin(admin.ModelAdmin):
654 list_display = ('nom', 'nom_long', 'date_modification', 'user_modification', 'actif', )
655 fieldsets = AUFMetadataAdminMixin.fieldsets + (
656 (None, {
657 'fields': ('nom', 'nom_long', ),
658 }),
659 )
660
661
662 class TypePosteAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
663 search_fields = ('nom', 'nom_feminin', )
664 list_display = ('nom', 'famille_emploi', 'date_modification', 'user_modification', 'actif', )
665 list_filter = ('famille_emploi', )
666 fieldsets = AUFMetadataAdminMixin.fieldsets + (
667 (None, {
668 'fields': ('nom', 'nom_feminin', 'is_responsable', 'famille_emploi', )
669 }),
670 )
671
672
673 class TypeRemunerationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
674 list_display = ('nom', 'type_paiement', 'nature_remuneration', 'date_modification', 'user_modification', 'actif', )
675 fieldsets = AUFMetadataAdminMixin.fieldsets + (
676 (None, {
677 'fields': ('nom', 'type_paiement', 'nature_remuneration', )
678 }),
679 )
680
681
682 class TypeRevalorisationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
683 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
684 fieldsets = AUFMetadataAdminMixin.fieldsets + (
685 (None, {
686 'fields': ('nom', )
687 }),
688 )
689
690
691 class ValeurPointAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
692 list_display = ('_devise_code', '_devise_nom', 'annee', 'valeur', 'date_modification', 'user_modification', )
693 list_filter = ('annee', 'devise', )
694 fieldsets = AUFMetadataAdminMixin.fieldsets + (
695 (None, {
696 'fields': ('valeur', 'devise', 'implantation', 'annee', )
697 }),
698 )
699
700 def _devise_code(self, obj):
701 return obj.devise.code
702 _devise_code.short_description = "Code de la devise"
703
704 def _devise_nom(self, obj):
705 return obj.devise.nom
706 _devise_nom.short_description = "Nom de la devise"
707
708
709 admin.site.register(rh.Classement, ClassementAdmin)
710 admin.site.register(rh.Devise, DeviseAdmin)
711 admin.site.register(rh.Dossier, DossierAdmin)
712 admin.site.register(rh.Employe, EmployeAdmin)
713 admin.site.register(rh.FamilleEmploi, FamilleEmploiAdmin)
714 admin.site.register(rh.OrganismeBstg, OrganismeBstgAdmin)
715 admin.site.register(rh.Poste, PosteAdmin)
716 admin.site.register(rh.ResponsableImplantation, ResponsableImplantationAdmin)
717 admin.site.register(rh.Service, ServiceAdmin)
718 admin.site.register(rh.Statut, StatutAdmin)
719 admin.site.register(rh.TauxChange, TauxChangeAdmin)
720 admin.site.register(rh.TypeContrat, TypeContratAdmin)
721 admin.site.register(rh.TypePoste, TypePosteAdmin)
722 admin.site.register(rh.TypeRemuneration, TypeRemunerationAdmin)
723 admin.site.register(rh.TypeRevalorisation, TypeRevalorisationAdmin)
724 admin.site.register(rh.ValeurPoint, ValeurPointAdmin)