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