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