909ca30a3c9646724f2aae39c24d16f6c22b96f0
[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.save()
357
358
359 class DossierPieceAdmin(admin.ModelAdmin):
360 pass
361
362
363 class DossierCommentaireAdmin(admin.ModelAdmin):
364 pass
365
366
367 class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
368 alphabet_filter = 'nom'
369 DEFAULT_ALPHABET = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
370 search_fields = ('id', 'nom', 'prenom', 'nom_affichage', )
371 ordering = ('nom', )
372 form = EmployeAdminForm
373 list_display = ('_apercu', '_nom', '_dossiers', 'date_modification', 'user_modification', 'actif',)
374 list_filter = ('rh_dossiers__poste__implantation__region', 'rh_dossiers__poste__implantation', 'nb_postes', 'actif', )
375 inlines = (AyantDroitInline,
376 DossierROInline,
377 EmployePieceInline,
378 EmployeCommentaireInline)
379 fieldsets = AUFMetadataAdminMixin.fieldsets + (
380 ('Identification', {
381 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', )
382 }),
383 ('Informations personnelles', {
384 'fields': ('situation_famille', 'date_entree', )
385 }),
386 ('Coordonnées', {
387 'fields': (('tel_domicile', 'tel_cellulaire'), ('adresse', 'ville'), ('code_postal', 'province'), 'pays', )
388 }),
389 )
390
391 def _apercu(self, obj):
392 return u"""<a title="Aperçu de l'employé" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a>""" % \
393 (reverse('employe_apercu', args=(obj.id,)), settings.STATIC_URL)
394 _apercu.allow_tags = True
395 _apercu.short_description = u""
396 _apercu.admin_order_field = ""
397
398 def _nom(self, obj):
399 edit_link = reverse('admin:rh_employe_change', args=(obj.id,))
400 return u"""<a href='%s'><strong>[%s] %s %s</strong></a>""" % \
401 (edit_link, obj.id, obj.nom.upper(), obj.prenom.title(),)
402 _nom.allow_tags = True
403 _nom.short_description = u"Employé ([code] NOM Prénom)"
404 _nom.admin_order_field = "nom"
405
406 def _dossiers(self, obj):
407 l = []
408 for d in obj.rh_dossiers.all().order_by('-date_debut'):
409 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>""" % \
410 (reverse('dossier_apercu', args=(d.id,)), settings.STATIC_URL,)
411 link = u"""<li>%s<a href='%s'>%s : %s</a></li>""" % \
412 (apercu,
413 reverse('admin:rh_dossier_change', args=(d.id,)),
414 d.date_debut.year,
415 d.poste,
416 )
417
418 # Dossier terminé en gris non cliquable
419 if d.date_fin is not None:
420 link = u"""<li style="color: grey">%s : %s</li>""" % \
421 (d.date_debut.year,
422 d.poste,
423 )
424
425 l.append(link)
426 return "<ul>%s</ul>" % "\n".join(l)
427 _dossiers.allow_tags = True
428 _dossiers.short_description = u"Dossiers"
429
430 def queryset(self, request):
431 qs = super(EmployeAdmin, self).queryset(request)
432 return qs.select_related(depth=1).order_by('nom')
433
434 def save_formset(self, request, form, formset, change):
435 instances = formset.save(commit=False)
436 for instance in instances:
437 if instance.__class__ == rh.EmployeCommentaire:
438 instance.owner = request.user
439 instance.save()
440
441
442
443 class EmployeCommentaireAdmin(admin.ModelAdmin):
444 pass
445
446
447 class EmployePieceAdmin(admin.ModelAdmin):
448 pass
449
450
451 class FamilleEmploiAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
452 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
453 inlines = (TypePosteInline,)
454 fieldsets = AUFMetadataAdminMixin.fieldsets + (
455 (None, {
456 'fields': ('nom', )
457 }),
458 )
459
460
461 class OrganismeBstgAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
462 search_fields = ('nom',)
463 list_display = ('nom', 'type', 'pays', 'date_modification', 'user_modification', 'actif', )
464 list_filter = ('type', )
465 inlines = (DossierROInline,)
466 fieldsets = AUFMetadataAdminMixin.fieldsets + (
467 (None, {
468 'fields': ('nom', 'type', 'pays', )
469 }),
470 )
471
472
473 class PosteAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
474 form = make_ajax_form(rh.Poste, {
475 'implantation' : 'implantations',
476 'type_poste' : 'typepostes',
477 'responsable' : 'postes',
478 'valeur_point_min' : 'valeurpoints',
479 'valeur_point_max' : 'valeurpoints',
480 })
481 alphabet_filter = 'nom'
482 search_fields = ('nom',
483 'implantation__code',
484 'implantation__nom',
485 'implantation__region__code',
486 'implantation__region__nom',
487 )
488 list_display = (
489 '_apercu',
490 '_nom',
491 '_occupe_par',
492 'implantation',
493 '_service',
494 'date_debut',
495 'date_fin',
496 'date_modification',
497 'user_modification',
498 'actif',
499 )
500 list_filter = ('service',
501 'implantation__region',
502 'implantation',
503 'type_poste',
504 'type_poste__famille_emploi',
505 'vacant',
506 'actif',
507 )
508 fieldsets = AUFMetadataAdminMixin.fieldsets + (
509 (None, {
510 'fields': (('nom', 'nom_feminin'), 'implantation', 'type_poste',
511 'service', 'responsable')
512 }),
513 ('Contrat', {
514 'fields': (('regime_travail', 'regime_travail_nb_heure_semaine'), )
515 }),
516 ('Recrutement', {
517 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),)
518 }),
519 ('Rémunération', {
520 'fields': (('classement_min', 'valeur_point_min', 'devise_min', 'salaire_min', 'indemn_min', 'autre_min', ),
521 ('classement_max', 'valeur_point_max' ,'devise_max', 'salaire_max', 'indemn_max', 'autre_max', ),
522 )
523 }),
524 ('Comparatifs de rémunération', {
525 'fields': ('devise_comparaison',
526 ('comp_locale_min', 'comp_locale_max'),
527 ('comp_universite_min', 'comp_universite_max'),
528 ('comp_fonctionpub_min', 'comp_fonctionpub_max'),
529 ('comp_ong_min', 'comp_ong_max'),
530 ('comp_autre_min', 'comp_autre_max'))
531 }),
532 ('Justification', {
533 'fields': ('justification',)
534 }),
535 ('Autres Méta-données', {
536 'fields': ('date_debut', 'date_fin')
537 }),
538 )
539
540 inlines = (PosteFinancementInline,
541 PostePieceInline,
542 DossierROInline,
543 PosteComparaisonInline,
544 PosteCommentaireInline, )
545
546
547 def _apercu(self, poste):
548 link = u"""<a onclick="return showAddAnotherPopup(this);" title="Aperçu du poste" href='%s'><img src="%simg/loupe.png" /></a>""" % \
549 (reverse('poste_apercu', args=(poste.id,)),
550 settings.STATIC_URL,
551 )
552 return link
553 _apercu.allow_tags = True
554 _apercu.short_description = u''
555 _apercu.admin_order_field = ''
556
557 def _service(self, obj):
558 return obj.service
559
560 def _nom(self, poste):
561 link = u"""<a href="%s" title="Modifier le poste"><strong>%s</strong></a>""" % \
562 (reverse('admin:rh_poste_change', args=(poste.id,)),
563 poste.nom,
564 )
565 return link
566 _nom.allow_tags = True
567 _nom.short_description = u'Nom'
568 _nom.admin_order_field = 'nom'
569
570 def _occupe_par(self, obj):
571 """Formatte la méthode Poste.occupe_par() pour l'admin"""
572 output = u"Vacant"
573 if obj.actif is False:
574 return u"s/o"
575 employes = obj.occupe_par()
576 if employes:
577 l = []
578 for e in employes:
579 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>" % \
580 (reverse('employe_apercu', args=(e.id,)),
581 settings.STATIC_URL,
582 reverse('admin:rh_employe_change', args=(e.id,)),
583 e
584 )
585 l.append(link)
586 output = "\n<br />".join(l)
587 return output
588 _occupe_par.allow_tags = True
589 _occupe_par.short_description = "Occupé par"
590
591 def save_formset(self, request, form, formset, change):
592 instances = formset.save(commit=False)
593 for instance in instances:
594 if instance.__class__ == rh.PosteCommentaire:
595 instance.owner = request.user
596 instance.save()
597 formset.save_m2m()
598
599
600 class PosteCommentaireAdmin(admin.ModelAdmin):
601 pass
602
603
604 class PosteFinancementAdmin(admin.ModelAdmin):
605 pass
606
607
608 class PostePieceAdmin(admin.ModelAdmin):
609 fk_name = 'poste'
610
611
612 class RemunerationAdmin(admin.ModelAdmin):
613 pass
614
615
616 class ResponsableImplantationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
617 fieldsets = AUFMetadataAdminMixin.fieldsets + (
618 (None, {
619 'fields': ('employe', 'implantation', ),
620 }),
621 )
622
623
624 class ServiceAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
625 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
626 fieldsets = AUFMetadataAdminMixin.fieldsets + (
627 (None, {
628 'fields': ('nom', ),
629 }),
630 )
631
632 class StatutAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
633 list_display = ('code', 'nom', 'date_modification', 'user_modification', 'actif', )
634 fieldsets = AUFMetadataAdminMixin.fieldsets + (
635 (None, {
636 'fields': ('code', 'nom', ),
637 }),
638 )
639
640 class TauxChangeAdmin(admin.ModelAdmin):
641 list_display = ('taux', 'devise', 'annee', 'date_modification', 'user_modification', )
642 list_filter = ('devise', )
643 fieldsets = AUFMetadataAdminMixin.fieldsets + (
644 (None, {
645 'fields': ('taux', 'devise', 'annee', ),
646 }),
647 )
648
649 class TypeContratAdmin(admin.ModelAdmin):
650 list_display = ('nom', 'nom_long', 'date_modification', 'user_modification', 'actif', )
651 fieldsets = AUFMetadataAdminMixin.fieldsets + (
652 (None, {
653 'fields': ('nom', 'nom_long', ),
654 }),
655 )
656
657
658 class TypePosteAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
659 search_fields = ('nom', 'nom_feminin', )
660 list_display = ('nom', 'famille_emploi', 'date_modification', 'user_modification', 'actif', )
661 list_filter = ('famille_emploi', )
662 fieldsets = AUFMetadataAdminMixin.fieldsets + (
663 (None, {
664 'fields': ('nom', 'nom_feminin', 'is_responsable', 'famille_emploi', )
665 }),
666 )
667
668
669 class TypeRemunerationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
670 list_display = ('nom', 'type_paiement', 'nature_remuneration', 'date_modification', 'user_modification', 'actif', )
671 fieldsets = AUFMetadataAdminMixin.fieldsets + (
672 (None, {
673 'fields': ('nom', 'type_paiement', 'nature_remuneration', )
674 }),
675 )
676
677
678 class TypeRevalorisationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
679 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
680 fieldsets = AUFMetadataAdminMixin.fieldsets + (
681 (None, {
682 'fields': ('nom', )
683 }),
684 )
685
686
687 class ValeurPointAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
688 list_display = ('_devise_code', '_devise_nom', 'annee', 'valeur', 'date_modification', 'user_modification', )
689 list_filter = ('annee', 'devise', )
690 fieldsets = AUFMetadataAdminMixin.fieldsets + (
691 (None, {
692 'fields': ('valeur', 'devise', 'implantation', 'annee', )
693 }),
694 )
695
696 def _devise_code(self, obj):
697 return obj.devise.code
698 _devise_code.short_description = "Code de la devise"
699
700 def _devise_nom(self, obj):
701 return obj.devise.nom
702 _devise_nom.short_description = "Nom de la devise"
703
704
705 admin.site.register(rh.Classement, ClassementAdmin)
706 admin.site.register(rh.Devise, DeviseAdmin)
707 admin.site.register(rh.Dossier, DossierAdmin)
708 admin.site.register(rh.Employe, EmployeAdmin)
709 admin.site.register(rh.FamilleEmploi, FamilleEmploiAdmin)
710 admin.site.register(rh.OrganismeBstg, OrganismeBstgAdmin)
711 admin.site.register(rh.Poste, PosteAdmin)
712 admin.site.register(rh.ResponsableImplantation, ResponsableImplantationAdmin)
713 admin.site.register(rh.Service, ServiceAdmin)
714 admin.site.register(rh.Statut, StatutAdmin)
715 admin.site.register(rh.TauxChange, TauxChangeAdmin)
716 admin.site.register(rh.TypeContrat, TypeContratAdmin)
717 admin.site.register(rh.TypePoste, TypePosteAdmin)
718 admin.site.register(rh.TypeRemuneration, TypeRemunerationAdmin)
719 admin.site.register(rh.TypeRevalorisation, TypeRevalorisationAdmin)
720 admin.site.register(rh.ValeurPoint, ValeurPointAdmin)