dates
[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 '_apercu',
232 '_id',
233 '_poste',
234 '_employe',
235 '_date_debut',
236 '_date_fin',
237 'date_modification',
238 'user_modification',
239 'actif',
240 )
241 list_filter = (
242 'poste__implantation__region',
243 'poste__implantation',
244 'poste__type_poste',
245 'poste__type_poste__famille_emploi',
246 'rh_contrats__type_contrat',
247 'actif',
248 )
249 inlines = (DossierPieceInline, ContratInline,
250 RemunerationInline,
251 DossierCommentaireInline,
252 )
253 fieldsets = AUFMetadataAdminMixin.fieldsets + (
254 (None, {
255 'fields': ('employe', 'poste', 'statut', 'organisme_bstg',)
256 }),
257 ('Recrutement', {
258 'fields': ('statut_residence', 'remplacement', 'remplacement_de', )
259 }),
260 ('Rémunération', {
261 'fields': ('classement', ('regime_travail', 'regime_travail_nb_heure_semaine'),)
262 }),
263 ('Occupation du Poste par cet Employe', {
264 'fields': (('date_debut', 'date_fin'), )
265 }),
266 )
267 form = make_ajax_form(rh.Dossier, {
268 'employe' : 'employes',
269 'poste' : 'postes',
270 'remplacement_de' : 'dossiers',
271 })
272
273 def lookup_allowed(self, key, value):
274 if key in (
275 'employe__nom__istartswith',
276 'actif__exact',
277 'poste__implantation__region__id__exact',
278 'poste__implantation__id__exact',
279 'poste__type_poste__id__exact',
280 'poste__type_poste__famille_emploi__id__exact',
281 'rh_contrats__type_contrat__id__exact',
282 ):
283 return True
284
285 def _apercu(self, d):
286 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.MEDIA_URL,
289 )
290 return link
291 _apercu.allow_tags = True
292 _apercu.short_description = u''
293 _apercu.admin_order_field = ''
294
295 def _id(self, d):
296 link = u"""<a href="%s" title="Modifier le dossier"><strong>%s</strong></a>""" % \
297 (reverse('admin:rh_dossier_change', args=(d.id,)),
298 d.id,
299 )
300 return link
301 _id.allow_tags = True
302 _id.short_description = u'#'
303 _id.admin_order_field = 'id'
304
305
306 def _actif(self, dossier):
307 if dossier.employe.actif:
308 html = """<img alt="True" src="%simg/admin/icon-yes.gif">"""
309 else:
310 html = """<img alt="False" src="%simg/admin/icon-no.gif">"""
311 return html % settings.ADMIN_MEDIA_PREFIX
312 _actif.allow_tags = True
313 _actif.short_description = u'Employé actif'
314 _actif.admin_order_field = 'employe__actif'
315
316 def _date_debut(self, obj):
317 return date(obj.date_debut)
318
319 _date_debut.short_description = u'Occupation début'
320 _date_debut.admin_order_field = 'date_debut'
321
322 def _date_fin(self, obj):
323 return date(obj.date_fin)
324 _date_fin.short_description = u'Occupation fin'
325 _date_fin.admin_order_field = 'date_fin'
326
327 def _poste(self, dossier):
328 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>""" % \
329 (reverse('poste_apercu', args=(dossier.poste.id,)),
330 settings.MEDIA_URL,
331 reverse('admin:rh_poste_change', args=(dossier.poste.id,)),
332 dossier.poste,
333 )
334 return link
335 _poste.allow_tags = True
336 _poste.short_description = u'Poste'
337 _poste.admin_order_field = 'poste__nom'
338
339 def _employe(self, obj):
340 employe = obj.employe
341 view_link = reverse('employe_apercu', args=(employe.id,))
342 edit_link = reverse('admin:rh_employe_change', args=(employe.id,))
343
344 if employe.actif == False:
345 style = "color: grey";
346 view = ""
347 else:
348 style = ""
349 view = u"""<a href="%s" title="Aperçu l'employé" onclick="return showAddAnotherPopup(this);"><img src="%simg/loupe.png" /></a>""" % (view_link, settings.MEDIA_URL,)
350 return u"""%s<a href='%s' style="%s;">[%s] %s %s</a>""" % \
351 (view, edit_link, style, employe.id, employe.nom.upper(), employe.prenom.title())
352 _employe.allow_tags = True
353 _employe.short_description = u"Employé ([code] NOM Prénom)"
354 _employe.admin_order_field = "employe__nom"
355
356 def save_formset(self, request, form, formset, change):
357 instances = formset.save(commit=False)
358 for instance in instances:
359 if instance.__class__ == rh.DossierCommentaire:
360 instance.owner = request.user
361 instance.save()
362
363
364 class DossierPieceAdmin(admin.ModelAdmin):
365 pass
366
367
368 class DossierCommentaireAdmin(admin.ModelAdmin):
369 pass
370
371
372 class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
373 alphabet_filter = 'nom'
374 DEFAULT_ALPHABET = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
375 search_fields = ('id', 'nom', 'prenom', 'nom_affichage', )
376 ordering = ('nom', )
377 form = EmployeAdminForm
378 list_display = ('_apercu', '_nom', '_dossiers', 'date_modification', 'user_modification', 'actif',)
379 list_filter = ('rh_dossiers__poste__implantation__region', 'rh_dossiers__poste__implantation', 'nb_postes', 'actif', )
380 inlines = (AyantDroitInline,
381 DossierROInline,
382 EmployePieceInline,
383 EmployeCommentaireInline)
384 fieldsets = AUFMetadataAdminMixin.fieldsets + (
385 ('Identification', {
386 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', )
387 }),
388 ('Informations personnelles', {
389 'fields': ('situation_famille', 'date_entree', )
390 }),
391 ('Coordonnées', {
392 'fields': (('tel_domicile', 'tel_cellulaire'), ('adresse', 'ville'), ('code_postal', 'province'), 'pays', )
393 }),
394 )
395
396 def _apercu(self, obj):
397 return u"""<a title="Aperçu de l'employé" onclick="return showAddAnotherPopup(this);" href='%s'><img src="%simg/loupe.png" /></a>""" % \
398 (reverse('employe_apercu', args=(obj.id,)), settings.MEDIA_URL)
399 _apercu.allow_tags = True
400 _apercu.short_description = u""
401 _apercu.admin_order_field = ""
402
403 def _nom(self, obj):
404 edit_link = reverse('admin:rh_employe_change', args=(obj.id,))
405 return u"""<a href='%s'><strong>[%s] %s %s</strong></a>""" % \
406 (edit_link, obj.id, obj.nom.upper(), obj.prenom.title(),)
407 _nom.allow_tags = True
408 _nom.short_description = u"Employé ([code] NOM Prénom)"
409 _nom.admin_order_field = "nom"
410
411 def _dossiers(self, obj):
412 l = []
413 for d in obj.rh_dossiers.all().order_by('-date_debut'):
414 style = ""
415 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>""" % \
416 (reverse('dossier_apercu', args=(d.id,)), settings.MEDIA_URL,)
417
418 if d.date_fin is not None:
419 apercu = ""
420 style = u"color: grey";
421 link = u"""<li>%s<a style="%s;" href='%s'>%s : %s</a></li>""" % \
422 (apercu,
423 style,
424 reverse('admin:rh_dossier_change', args=(d.id,)),
425 d.date_debut.year,
426 d.poste,
427 )
428 l.append(link)
429 return "<ul>%s</ul>" % "\n".join(l)
430 _dossiers.allow_tags = True
431 _dossiers.short_description = u"Dossiers"
432
433 def queryset(self, request):
434 qs = super(EmployeAdmin, self).queryset(request)
435 return qs.select_related(depth=1).order_by('nom')
436
437 def save_formset(self, request, form, formset, change):
438 instances = formset.save(commit=False)
439 for instance in instances:
440 if instance.__class__ == rh.EmployeCommentaire:
441 instance.owner = request.user
442 instance.save()
443
444
445
446 class EmployeCommentaireAdmin(admin.ModelAdmin):
447 pass
448
449
450 class EmployePieceAdmin(admin.ModelAdmin):
451 pass
452
453
454 class FamilleEmploiAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
455 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
456 inlines = (TypePosteInline,)
457 fieldsets = AUFMetadataAdminMixin.fieldsets + (
458 (None, {
459 'fields': ('nom', )
460 }),
461 )
462
463
464 class OrganismeBstgAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
465 search_fields = ('nom',)
466 list_display = ('nom', 'type', 'pays', 'date_modification', 'user_modification', 'actif', )
467 list_filter = ('type', )
468 inlines = (DossierROInline,)
469 fieldsets = AUFMetadataAdminMixin.fieldsets + (
470 (None, {
471 'fields': ('nom', 'type', 'pays', )
472 }),
473 )
474
475
476 class PosteAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin, AjaxSelect):
477 form = make_ajax_form(rh.Poste, {
478 'implantation' : 'implantations',
479 'type_poste' : 'typepostes',
480 'responsable' : 'postes',
481 'valeur_point_min' : 'valeurpoints',
482 'valeur_point_max' : 'valeurpoints',
483 })
484 alphabet_filter = 'nom'
485 search_fields = ('nom',
486 'implantation__code',
487 'implantation__nom',
488 'implantation__region__code',
489 'implantation__region__nom',
490 )
491 list_display = (
492 '_apercu',
493 '_nom',
494 '_occupe_par',
495 'implantation',
496 '_service',
497 'date_debut',
498 'date_fin',
499 'date_modification',
500 'user_modification',
501 'actif',
502 )
503 list_filter = ('service',
504 'implantation__region',
505 'implantation',
506 'type_poste',
507 'type_poste__famille_emploi',
508 'vacant',
509 'actif',
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
550 def _apercu(self, poste):
551 link = u"""<a onclick="return showAddAnotherPopup(this);" title="Aperçu du poste" href='%s'><img src="%simg/loupe.png" /></a>""" % \
552 (reverse('poste_apercu', args=(poste.id,)),
553 settings.MEDIA_URL,
554 )
555 return link
556 _apercu.allow_tags = True
557 _apercu.short_description = u''
558 _apercu.admin_order_field = ''
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.MEDIA_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.save()
600 formset.save_m2m()
601
602
603 class PosteCommentaireAdmin(admin.ModelAdmin):
604 pass
605
606
607 class PosteFinancementAdmin(admin.ModelAdmin):
608 pass
609
610
611 class PostePieceAdmin(admin.ModelAdmin):
612 fk_name = 'poste'
613
614
615 class RemunerationAdmin(admin.ModelAdmin):
616 pass
617
618
619 class ResponsableImplantationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
620 fieldsets = AUFMetadataAdminMixin.fieldsets + (
621 (None, {
622 'fields': ('employe', 'implantation', ),
623 }),
624 )
625
626
627 class ServiceAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
628 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
629 fieldsets = AUFMetadataAdminMixin.fieldsets + (
630 (None, {
631 'fields': ('nom', ),
632 }),
633 )
634
635 class StatutAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
636 list_display = ('code', 'nom', 'date_modification', 'user_modification', 'actif', )
637 fieldsets = AUFMetadataAdminMixin.fieldsets + (
638 (None, {
639 'fields': ('code', 'nom', ),
640 }),
641 )
642
643 class TauxChangeAdmin(admin.ModelAdmin):
644 list_display = ('taux', 'devise', 'annee', 'date_modification', 'user_modification', )
645 list_filter = ('devise', )
646 fieldsets = AUFMetadataAdminMixin.fieldsets + (
647 (None, {
648 'fields': ('taux', 'devise', 'annee', ),
649 }),
650 )
651
652 class TypeContratAdmin(admin.ModelAdmin):
653 list_display = ('nom', 'nom_long', 'date_modification', 'user_modification', 'actif', )
654 fieldsets = AUFMetadataAdminMixin.fieldsets + (
655 (None, {
656 'fields': ('nom', 'nom_long', ),
657 }),
658 )
659
660
661 class TypePosteAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
662 search_fields = ('nom', 'nom_feminin', )
663 list_display = ('nom', 'famille_emploi', 'date_modification', 'user_modification', 'actif', )
664 list_filter = ('famille_emploi', )
665 fieldsets = AUFMetadataAdminMixin.fieldsets + (
666 (None, {
667 'fields': ('nom', 'nom_feminin', 'is_responsable', 'famille_emploi', )
668 }),
669 )
670
671
672 class TypeRemunerationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
673 list_display = ('nom', 'type_paiement', 'nature_remuneration', 'date_modification', 'user_modification', 'actif', )
674 fieldsets = AUFMetadataAdminMixin.fieldsets + (
675 (None, {
676 'fields': ('nom', 'type_paiement', 'nature_remuneration', )
677 }),
678 )
679
680
681 class TypeRevalorisationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
682 list_display = ('nom', 'date_modification', 'user_modification', 'actif', )
683 fieldsets = AUFMetadataAdminMixin.fieldsets + (
684 (None, {
685 'fields': ('nom', )
686 }),
687 )
688
689
690 class ValeurPointAdmin(AUFMetadataAdminMixin, admin.ModelAdmin):
691 list_display = ('_devise_code', '_devise_nom', 'annee', 'valeur', 'date_modification', 'user_modification', )
692 list_filter = ('annee', 'devise', )
693 fieldsets = AUFMetadataAdminMixin.fieldsets + (
694 (None, {
695 'fields': ('valeur', 'devise', 'implantation', 'annee', )
696 }),
697 )
698
699 def _devise_code(self, obj):
700 return obj.devise.code
701 _devise_code.short_description = "Code de la devise"
702
703 def _devise_nom(self, obj):
704 return obj.devise.nom
705 _devise_nom.short_description = "Nom de la devise"
706
707
708 admin.site.register(rh.Classement, ClassementAdmin)
709 admin.site.register(rh.Devise, DeviseAdmin)
710 admin.site.register(rh.Dossier, DossierAdmin)
711 admin.site.register(rh.Employe, EmployeAdmin)
712 admin.site.register(rh.FamilleEmploi, FamilleEmploiAdmin)
713 admin.site.register(rh.OrganismeBstg, OrganismeBstgAdmin)
714 admin.site.register(rh.Poste, PosteAdmin)
715 admin.site.register(rh.ResponsableImplantation, ResponsableImplantationAdmin)
716 admin.site.register(rh.Service, ServiceAdmin)
717 admin.site.register(rh.Statut, StatutAdmin)
718 admin.site.register(rh.TauxChange, TauxChangeAdmin)
719 admin.site.register(rh.TypeContrat, TypeContratAdmin)
720 admin.site.register(rh.TypePoste, TypePosteAdmin)
721 admin.site.register(rh.TypeRemuneration, TypeRemunerationAdmin)
722 admin.site.register(rh.TypeRevalorisation, TypeRevalorisationAdmin)
723 admin.site.register(rh.ValeurPoint, ValeurPointAdmin)