1 # -*- encoding: utf-8 -*-
5 from django
.core
.urlresolvers
import reverse
6 from django
.contrib
import admin
7 from django
.conf
import settings
8 from django
.db
.models
import Q
9 from django
.template
.defaultfilters
import date
10 from ajax_select
import make_ajax_form
11 from auf
.django
.metadata
.admin
import AUFMetadataAdminMixin
, \
12 AUFMetadataInlineAdminMixin
, \
13 AUF_METADATA_READONLY_FIELDS
14 from forms
import ContratForm
, AyantDroitForm
, EmployeAdminForm
, AjaxSelect
15 from dae
.utils
import get_employe_from_user
16 from change_list
import ChangeList
17 from groups
import grp_drh
21 class EmployeProxy(rh
.Employe
):
25 verbose_name
= u
"Organigramme des employés"
26 verbose_name_plural
= u
"Organigramme des employés"
29 class DateRangeMixin(object):
30 prefixe_recherche_temporelle
= ""
32 def get_changelist(self
, request
, **kwargs
):
33 if 'HTTP_REFERER' in request
.META
.keys():
34 referer
= request
.META
['HTTP_REFERER']
35 referer
= "/".join(referer
.split('/')[3:])
36 referer
= "/%s" % referer
.split('?')[0]
37 change_list_view
= 'admin:%s_%s_changelist' % (
38 self
.model
._meta
.app_label
,
39 self
.model
.__name__
.lower(),)
40 if referer
!= reverse(change_list_view
):
41 params
= request
.GET
.copy()
42 params
.update({'statut': 'Actif'})
47 # Override of the InlineModelAdmin to support the link in the tabular inline
48 class LinkedInline(admin
.options
.InlineModelAdmin
):
49 template
= "admin/linked.html"
50 admin_model_path
= None
52 def __init__(self
, *args
):
53 super(LinkedInline
, self
).__init__(*args
)
54 if self
.admin_model_path
is None:
55 self
.admin_model_path
= self
.model
.__name__
.lower()
58 class ProtectRegionMixin(object):
60 def queryset(self
, request
):
61 from dae
.workflow
import grp_drh
, grp_correspondants_rh
62 qs
= super(ProtectRegionMixin
, self
).queryset(request
)
64 if request
.user
.is_superuser
:
67 user_groups
= request
.user
.groups
.all()
69 if grp_drh
in user_groups
:
72 if grp_correspondants_rh
in user_groups
:
73 employe
= get_employe_from_user(request
.user
)
74 q
= Q(**{self
.model
.prefix_implantation
: \
75 employe
.implantation
.region
})
76 qs
= qs
.filter(q
).distinct()
80 def has_change_permission(self
, request
, obj
=None):
81 user_groups
= request
.user
.groups
.all()
83 # Lock pour autoriser uniquement les DRH à utiliser RH
84 if not request
.user
.is_superuser
and not grp_drh
in user_groups
:
87 if len(user_groups
) == 0 and not request
.user
.is_superuser
:
92 ids
= [o
.id for o
in self
.queryset(request
)]
98 class ReadOnlyInlineMixin(object):
100 def get_readonly_fields(self
, request
, obj
=None):
101 return [f
.name
for f
in self
.model
._meta
.fields \
102 if f
.name
not in AUF_METADATA_READONLY_FIELDS
]
105 class AyantDroitInline(AUFMetadataInlineAdminMixin
, admin
.StackedInline
):
106 model
= rh
.AyantDroit
107 form
= AyantDroitForm
114 ('nom_affichage', 'genre'),
122 class AyantDroitCommentaireInline(AUFMetadataInlineAdminMixin
, \
123 admin
.TabularInline
):
124 readonly_fields
= ('owner', )
125 model
= rh
.AyantDroitCommentaire
129 class ContratInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
135 class DossierROInline(ReadOnlyInlineMixin
, LinkedInline
):
136 template
= "admin/rh/dossier/linked.html"
137 exclude
= AUF_METADATA_READONLY_FIELDS
142 def has_add_permission(self
, request
=None):
145 def has_change_permission(self
, request
, obj
=None):
148 def has_delete_permission(self
, request
, obj
=None):
152 class DossierCommentaireInline(AUFMetadataInlineAdminMixin
, \
153 admin
.TabularInline
):
154 readonly_fields
= ('owner', )
155 model
= rh
.DossierCommentaire
159 class DossierPieceInline(admin
.TabularInline
):
160 model
= rh
.DossierPiece
164 class EmployeInline(admin
.TabularInline
):
168 class EmployeCommentaireInline(AUFMetadataInlineAdminMixin
, \
169 admin
.TabularInline
):
170 readonly_fields
= ('owner', )
171 model
= rh
.EmployeCommentaire
175 class EmployePieceInline(admin
.TabularInline
):
176 model
= rh
.EmployePiece
180 class PosteCommentaireInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
181 readonly_fields
= ('owner', )
182 model
= rh
.PosteCommentaire
186 class PosteFinancementInline(admin
.TabularInline
):
187 model
= rh
.PosteFinancement
190 class PostePieceInline(admin
.TabularInline
):
191 model
= rh
.PostePiece
194 class RemunerationInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
195 model
= rh
.Remuneration
199 class RemunerationROInline(ReadOnlyInlineMixin
, RemunerationInline
):
203 class TypePosteInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
207 class PosteComparaisonInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
208 model
= rh
.PosteComparaison
211 class ClassementAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
212 list_display
= ('_classement', '_date_modification', 'user_modification', )
213 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
215 'fields': ('type', 'echelon', 'degre', 'coefficient',)}),
218 def _classement(self
, obj
):
220 _classement
.short_description
= u
"Classement"
222 def _date_modification(self
, obj
):
223 return date(obj
.date_modification
) \
224 if obj
.date_modification
is not None else "(aucune)"
225 _date_modification
.short_description
= u
'date modification'
226 _date_modification
.admin_order_field
= 'date_modification'
229 class CommentaireAdmin(admin
.ModelAdmin
):
233 class DeviseAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
238 '_date_modification',
241 list_filter
= ('archive', )
242 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
244 'fields': ('code', 'nom', 'archive', ),
248 def queryset(self
, request
):
249 return self
.model
._base_manager
251 def _archive(self
, obj
):
256 _archive
.short_description
= u
'Archivé'
258 def _date_modification(self
, obj
):
259 return date(obj
.date_modification
) \
260 if obj
.date_modification
is not None else "(aucune)"
261 _date_modification
.short_description
= u
'date modification'
262 _date_modification
.admin_order_field
= 'date_modification'
265 class DossierAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
266 ProtectRegionMixin
, admin
.ModelAdmin
, AjaxSelect
,):
267 alphabet_filter
= 'employe__nom'
272 'poste__nom_feminin')
281 '_date_modification',
284 list_display_links
= ('_nom',)
286 'poste__implantation__region',
287 'poste__implantation',
288 'poste__type_poste__famille_emploi',
290 'rh_contrats__type_contrat',
292 inlines
= (DossierPieceInline
, ContratInline
,
294 DossierCommentaireInline
,
296 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
302 'organisme_bstg',)}),
307 'remplacement_de', )}),
311 ('regime_travail', 'regime_travail_nb_heure_semaine'),)}),
312 ('Occupation du Poste par cet Employe', {
313 'fields': (('date_debut', 'date_fin'), )}
316 form
= make_ajax_form(rh
.Dossier
, {
317 'employe': 'employes',
319 'remplacement_de': 'dossiers',
322 def lookup_allowed(self
, key
, value
):
324 'employe__nom__istartswith',
325 'poste__implantation__region__id__exact',
326 'poste__implantation__id__exact',
327 'poste__type_poste__id__exact',
328 'poste__type_poste__famille_emploi__id__exact',
329 'rh_contrats__type_contrat__id__exact',
335 _id
.short_description
= u
"#"
336 _id
.admin_order_field
= "id"
339 return "%d : %s %s" % (
341 obj
.employe
.nom
.upper(),
343 _nom
.allow_tags
= True
344 _nom
.short_description
= u
"Dossier"
346 def _apercu(self
, d
):
347 apercu_link
= u
"""<a title="Aperçu du dossier"
348 onclick="return showAddAnotherPopup(this);"
350 <img src="%simg/loupe.png" />
352 (reverse('dossier_apercu', args
=(d
.id,)),
356 _apercu
.allow_tags
= True
357 _apercu
.short_description
= u
""
359 def _date_debut(self
, obj
):
360 return date(obj
.date_debut
)
362 _date_debut
.short_description
= u
'Occupation début'
363 _date_debut
.admin_order_field
= 'date_debut'
365 def _date_fin(self
, obj
):
366 return date(obj
.date_fin
)
367 _date_fin
.short_description
= u
'Occupation fin'
368 _date_fin
.admin_order_field
= 'date_fin'
370 def _date_modification(self
, obj
):
371 return date(obj
.date_modification
) \
372 if obj
.date_modification
is not None else "(aucune)"
373 _date_modification
.short_description
= u
'date modification'
374 _date_modification
.admin_order_field
= 'date_modification'
376 def _poste(self
, dossier
):
377 link
= u
"""<a title="Aperçu du poste"
378 onclick="return showAddAnotherPopup(this);"
379 href='%s'><img src="%simg/loupe.png" />
381 <a href="%s" title="Modifier le poste">%s</a>""" % \
382 (reverse('poste_apercu', args
=(dossier
.poste
.id,)),
384 reverse('admin:rh_poste_change', args
=(dossier
.poste
.id,)),
388 _poste
.allow_tags
= True
389 _poste
.short_description
= u
'Poste'
390 _poste
.admin_order_field
= 'poste__nom'
392 def _employe(self
, obj
):
393 employe
= obj
.employe
394 view_link
= reverse('employe_apercu', args
=(employe
.id,))
395 edit_link
= reverse('admin:rh_employe_change', args
=(employe
.id,))
398 view
= u
"""<a href="%s"
399 title="Aperçu l'employé"
400 onclick="return showAddAnotherPopup(this);">
401 <img src="%simg/loupe.png" />
402 </a>""" % (view_link
, settings
.STATIC_URL
,)
403 return u
"""%s<a href='%s' style="%s;">%s</a>""" % \
404 (view
, edit_link
, style
, employe
)
405 _employe
.allow_tags
= True
406 _employe
.short_description
= u
"Employé"
407 _employe
.admin_order_field
= "employe__nom"
409 def save_formset(self
, request
, form
, formset
, change
):
410 instances
= formset
.save(commit
=False)
411 for instance
in instances
:
412 if instance
.__class__
== rh
.DossierCommentaire
:
413 instance
.owner
= request
.user
414 instance
.date_creation
= datetime
.datetime
.now()
418 class DossierPieceAdmin(admin
.ModelAdmin
):
422 class DossierCommentaireAdmin(admin
.ModelAdmin
):
426 class EmployeAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
427 ProtectRegionMixin
, admin
.ModelAdmin
,):
428 prefixe_recherche_temporelle
= "rh_dossiers__"
429 alphabet_filter
= 'nom'
430 DEFAULT_ALPHABET
= u
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
431 search_fields
= ('id', 'nom', 'prenom', 'nom_affichage', )
433 form
= EmployeAdminForm
439 '_date_modification',
442 list_display_links
= ('_nom',)
444 'rh_dossiers__poste__implantation__region',
445 'rh_dossiers__poste__implantation',
448 inlines
= (AyantDroitInline
,
451 EmployeCommentaireInline
)
452 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
456 ('nom_affichage', 'genre'),
461 ('Informations personnelles', {
462 'fields': ('situation_famille', 'date_entree', )}
466 ('tel_domicile', 'tel_cellulaire'),
467 ('adresse', 'ville'),
468 ('code_postal', 'province'),
474 def _apercu(self
, obj
):
475 return u
"""<a title="Aperçu de l'employé"
476 onclick="return showAddAnotherPopup(this);"
478 <img src="%simg/loupe.png" />
480 (reverse('employe_apercu', args
=(obj
.id,)), settings
.STATIC_URL
)
481 _apercu
.allow_tags
= True
482 _apercu
.short_description
= u
""
485 edit_link
= reverse('admin:rh_employe_change', args
=(obj
.id,))
486 return u
"""<a href='%s'><strong>%s</strong></a>""" % \
487 (edit_link
, "%s %s" % (obj
.nom
.upper(), obj
.prenom
))
488 _nom
.allow_tags
= True
489 _nom
.short_description
= u
"Employé"
490 _nom
.admin_order_field
= "nom"
494 _id
.short_description
= u
"#"
495 _id
.admin_order_field
= "id"
497 def _date_modification(self
, obj
):
498 return date(obj
.date_modification
) \
499 if obj
.date_modification
is not None else "(aucune)"
500 _date_modification
.short_description
= u
'date modification'
501 _date_modification
.admin_order_field
= 'date_modification'
503 def _dossiers_postes(self
, obj
):
505 for d
in obj
.rh_dossiers
.all().order_by('-date_debut'):
506 dossier
= u
"""<a title="Aperçu du dossier"
508 onclick="return showAddAnotherPopup(this);"
509 title="Aperçu du dossier">
510 <img src="%simg/loupe.png" />
512 <a href="%s">Dossier</a>
514 (reverse('dossier_apercu', args
=(d
.id,)),
516 reverse('admin:rh_dossier_change', args
=(d
.id,)))
518 poste
= u
"""<a title="Aperçu du poste"
520 onclick="return showAddAnotherPopup(this);"
521 title="Aperçu du poste">
522 <img src="%simg/loupe.png" />
524 <a href="%s">Poste</a>
526 (reverse('poste_apercu', args
=(d
.poste
.id,)),
528 reverse('admin:rh_poste_change', args
=(d
.poste
.id,)))
529 link
= u
"""<li>%s %s - %s : [%s] %s</li>""" % \
536 # Dossier terminé en gris non cliquable
537 if d
.date_fin
is not None and d
.date_fin
< datetime
.date
.today():
538 link
= u
"""<li style="color: grey">%s : [%s] %s</li>""" % \
545 return "<ul>%s</ul>" % "\n".join(l
)
546 _dossiers_postes
.allow_tags
= True
547 _dossiers_postes
.short_description
= u
"Dossiers et postes"
549 def queryset(self
, request
):
550 qs
= super(EmployeAdmin
, self
).queryset(request
)
551 return qs
.select_related(depth
=1).order_by('nom')
553 def save_formset(self
, request
, form
, formset
, change
):
554 instances
= formset
.save(commit
=False)
555 for instance
in instances
:
556 if instance
.__class__
== rh
.EmployeCommentaire
:
557 instance
.owner
= request
.user
558 instance
.date_creation
= datetime
.datetime
.now()
562 class EmployeProxyAdmin(EmployeAdmin
):
563 list_display
= ('_id', '_apercu', '_nom', '_organigramme')
564 list_display_links
= ('_nom',)
566 def has_add_permission(self
, obj
):
569 def _organigramme(self
, obj
):
571 for d
in obj
.rh_dossiers
.all().order_by('-date_debut'):
572 poste
= u
"""<a title="Aperçu du poste"
574 onclick="return showAddAnotherPopup(this);"
575 title="Aperçu du poste">
576 <img src="%simg/loupe.png" />
578 <a href="%s">Poste</a>
580 (reverse('poste_apercu', args
=(d
.poste
.id,)),
582 reverse('admin:rh_poste_change', args
=(d
.poste
.id,)))
583 organigramme
= u
"""<a href="%s">Organigramme</a>""" % \
584 (reverse('rho_employe', args
=(d
.poste
.id,)))
585 link
= u
"""<li>%s - %s - %s : [%s] %s</li>""" % \
586 (poste
, organigramme
,
592 return "<ul>%s</ul>" % "\n".join(l
)
594 _organigramme
.allow_tags
= True
595 _organigramme
.short_description
= "Organigramme"
598 class EmployeCommentaireAdmin(admin
.ModelAdmin
):
602 class EmployePieceAdmin(admin
.ModelAdmin
):
606 class FamilleEmploiAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
607 list_display
= ('nom', '_date_modification', 'user_modification', )
608 inlines
= (TypePosteInline
,)
609 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
610 (None, {'fields': ('nom', )}),)
612 def _date_modification(self
, obj
):
613 return date(obj
.date_modification
) \
614 if obj
.date_modification
is not None else "(aucune)"
615 _date_modification
.short_description
= u
'date modification'
616 _date_modification
.admin_order_field
= 'date_modification'
619 class OrganismeBstgAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
620 search_fields
= ('nom',)
625 '_date_modification',
628 list_filter
= ('type', )
629 inlines
= (DossierROInline
,)
630 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
631 (None, {'fields': ('nom', 'type', 'pays',)}),
634 def _date_modification(self
, obj
):
635 return date(obj
.date_modification
) \
636 if obj
.date_modification
is not None else "(aucune)"
637 _date_modification
.short_description
= u
'date modification'
638 _date_modification
.admin_order_field
= 'date_modification'
641 class PosteAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
642 ProtectRegionMixin
, admin
.ModelAdmin
, AjaxSelect
,):
643 form
= make_ajax_form(rh
.Poste
, {
644 'implantation': 'implantations',
645 'type_poste': 'typepostes',
646 'responsable': 'postes',
647 'valeur_point_min': 'valeurpoints',
648 'valeur_point_max': 'valeurpoints',
650 alphabet_filter
= 'nom'
653 'implantation__code',
655 'implantation__region__code',
656 'implantation__region__nom',
657 'rh_dossiers__employe__nom',
658 'rh_dossiers__employe__prenom',
670 '_date_modification',
674 'implantation__region',
678 'type_poste__famille_emploi',
681 list_display_links
= ('_nom',)
682 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
684 ('nom', 'nom_feminin'),
694 'regime_travail_nb_heure_semaine'),
698 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),)}
701 'fields': (('classement_min',
714 ('Comparatifs de rémunération', {
715 'fields': ('devise_comparaison',
716 ('comp_locale_min', 'comp_locale_max'),
717 ('comp_universite_min', 'comp_universite_max'),
718 ('comp_fonctionpub_min', 'comp_fonctionpub_max'),
719 ('comp_ong_min', 'comp_ong_max'),
720 ('comp_autre_min', 'comp_autre_max'))}
723 'fields': ('justification',)}
725 ('Autres Méta-données', {
726 'fields': ('date_debut', 'date_fin')}
730 inlines
= (PosteFinancementInline
,
733 PosteComparaisonInline
,
734 PosteCommentaireInline
, )
736 def lookup_allowed(self
, key
, value
):
739 'date_debut__isnull',
742 'implantation__region__id__exact',
743 'implantation__id__exact',
744 'type_poste__id__exact',
745 'type_poste__famille_emploi__id__exact',
746 'service__id__exact',
753 def _apercu(self
, poste
):
754 view_link
= u
"""<a onclick="return showAddAnotherPopup(this);"
755 title="Aperçu du poste"
757 <img src="%simg/loupe.png" />
759 (reverse('poste_apercu', args
=(poste
.id,)),
760 settings
.STATIC_URL
,)
762 _apercu
.allow_tags
= True
763 _apercu
.short_description
= ''
767 _id
.short_description
= '#'
768 _id
.admin_order_field
= 'id'
770 def _service(self
, obj
):
771 if obj
.service
.supprime
:
772 return """<span style="color:red">%s</span>""" % obj
.service
775 _service
.short_description
= 'Service'
776 _service
.allow_tags
= True
778 def _responsable(self
, obj
):
780 responsable
= u
"""<a href="%s"
781 onclick="return showAddAnotherPopup(this)">
782 <img src="%simg/loupe.png"
783 title="Aperçu du poste" />
787 (reverse('poste_apercu', args
=(obj
.responsable
.id,)),
789 reverse('admin:rh_poste_change', args
=(obj
.responsable
.id,)),
795 employe_id
= obj
.responsable
.rh_dossiers
.all()[0].id
798 onclick="return showAddAnotherPopup(this)">
799 <img src="%simg/loupe.png"
800 title="Aperçu de l'employé">
802 <a href="%s">%s</a>""" % \
803 (reverse('employe_apercu', args
=(employe_id
,)),
805 reverse('admin:rh_employe_change', args
=(employe_id
,)),
810 return "%s %s" % (responsable
, employe
)
811 _responsable
.short_description
= 'Responsable'
812 _responsable
.allow_tags
= True
814 def _nom(self
, poste
):
815 return """<a href="%s">%s</a>""" % \
816 (reverse('admin:rh_poste_change', args
=(poste
.id,)),
818 _nom
.allow_tags
= True
819 _nom
.short_description
= u
'Nom'
820 _nom
.admin_order_field
= 'nom'
822 def _date_modification(self
, obj
):
823 return date(obj
.date_modification
)
824 _date_modification
.short_description
= u
'date modification'
825 _date_modification
.admin_order_field
= 'date_modification'
827 def _occupe_par(self
, obj
):
828 """Formatte la méthode Poste.occupe_par() pour l'admin"""
830 if obj
.date_fin
is not None and obj
.date_fin
< datetime
.date
.now():
832 employes
= obj
.occupe_par()
836 link
= u
"""<a href='%s'
837 title='Aperçu de l\'employer'
838 onclick='return showAddAnotherPopup(this)'>
839 <img src='%simg/loupe.png' />
841 <a href='%s'>%s</a>""" % \
842 (reverse('employe_apercu', args
=(e
.id,)),
844 reverse('admin:rh_employe_change', args
=(e
.id,)),
847 output
= "\n<br />".join(l
)
849 _occupe_par
.allow_tags
= True
850 _occupe_par
.short_description
= "Occupé par"
852 def save_formset(self
, request
, form
, formset
, change
):
853 instances
= formset
.save(commit
=False)
854 for instance
in instances
:
855 if instance
.__class__
== rh
.PosteCommentaire
:
856 instance
.owner
= request
.user
857 instance
.date_creation
= datetime
.datetime
.now()
862 class PosteCommentaireAdmin(admin
.ModelAdmin
):
866 class PosteFinancementAdmin(admin
.ModelAdmin
):
870 class PostePieceAdmin(admin
.ModelAdmin
):
874 class RemunerationAdmin(admin
.ModelAdmin
):
878 class ResponsableImplantationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
879 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
881 'fields': ('employe', 'implantation', ),
886 class ServiceAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
890 '_date_modification',
893 list_filter
= ('archive', )
894 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
896 'fields': ('nom', 'archive', ),
900 def _archive(self
, obj
):
905 _archive
.short_description
= u
'Archivé'
907 def _date_modification(self
, obj
):
908 return date(obj
.date_modification
) \
909 if obj
.date_modification
is not None else "(aucune)"
910 _date_modification
.short_description
= u
'date modification'
911 _date_modification
.admin_order_field
= 'date_modification'
914 class StatutAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
915 list_display
= ('code', 'nom', '_date_modification', 'user_modification', )
916 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
918 'fields': ('code', 'nom', ),
922 def _date_modification(self
, obj
):
923 return date(obj
.date_modification
) \
924 if obj
.date_modification
is not None else "(aucune)"
925 _date_modification
.short_description
= u
'date modification'
926 _date_modification
.admin_order_field
= 'date_modification'
929 class TauxChangeAdmin(admin
.ModelAdmin
):
934 '_date_modification',
937 list_filter
= ('devise', )
938 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
940 'fields': ('taux', 'devise', 'annee', ),
944 def _date_modification(self
, obj
):
945 return date(obj
.date_modification
) \
946 if obj
.date_modification
is not None else "(aucune)"
947 _date_modification
.short_description
= u
'date modification'
948 _date_modification
.admin_order_field
= 'date_modification'
951 class TypeContratAdmin(admin
.ModelAdmin
):
955 '_date_modification',
958 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
960 'fields': ('nom', 'nom_long', ),
964 def _date_modification(self
, obj
):
965 return date(obj
.date_modification
) \
966 if obj
.date_modification
is not None else "(aucune)"
967 _date_modification
.short_description
= u
'date modification'
968 _date_modification
.admin_order_field
= 'date_modification'
971 class TypePosteAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
972 search_fields
= ('nom', 'nom_feminin', )
976 '_date_modification',
979 list_filter
= ('famille_emploi', )
980 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
991 def _date_modification(self
, obj
):
992 return date(obj
.date_modification
) \
993 if obj
.date_modification
is not None else "(aucune)"
994 _date_modification
.short_description
= u
'date modification'
995 _date_modification
.admin_order_field
= 'date_modification'
998 class TypeRemunerationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1002 'nature_remuneration',
1003 '_date_modification',
1004 'user_modification',)
1005 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1006 (None, {'fields': ('nom', 'type_paiement', 'nature_remuneration',)}),
1009 def _date_modification(self
, obj
):
1010 return date(obj
.date_modification
) \
1011 if obj
.date_modification
is not None else "(aucune)"
1012 _date_modification
.short_description
= u
'date modification'
1013 _date_modification
.admin_order_field
= 'date_modification'
1016 class TypeRevalorisationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1017 list_display
= ('nom', '_date_modification', 'user_modification', )
1018 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1019 (None, {'fields': ('nom', )}),
1022 def _date_modification(self
, obj
):
1023 return date(obj
.date_modification
) \
1024 if obj
.date_modification
is not None else "(aucune)"
1025 _date_modification
.short_description
= u
'date modification'
1026 _date_modification
.admin_order_field
= 'date_modification'
1029 class ValeurPointAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1035 '_date_modification',
1036 'user_modification',
1038 list_filter
= ('annee', 'devise', )
1039 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1040 (None, {'fields': ('valeur', 'devise', 'implantation', 'annee', )}),
1043 def _date_modification(self
, obj
):
1044 return date(obj
.date_modification
) \
1045 if obj
.date_modification
is not None else "(aucune)"
1046 _date_modification
.short_description
= u
'date modification'
1047 _date_modification
.admin_order_field
= 'date_modification'
1049 def _devise_code(self
, obj
):
1050 return obj
.devise
.code
1051 _devise_code
.short_description
= "Code de la devise"
1053 def _devise_nom(self
, obj
):
1054 return obj
.devise
.nom
1055 _devise_nom
.short_description
= "Nom de la devise"
1058 admin
.site
.register(rh
.Classement
, ClassementAdmin
)
1059 admin
.site
.register(rh
.Devise
, DeviseAdmin
)
1060 admin
.site
.register(rh
.Dossier
, DossierAdmin
)
1061 admin
.site
.register(EmployeProxy
, EmployeProxyAdmin
)
1062 admin
.site
.register(rh
.Employe
, EmployeAdmin
)
1063 admin
.site
.register(rh
.FamilleEmploi
, FamilleEmploiAdmin
)
1064 admin
.site
.register(rh
.OrganismeBstg
, OrganismeBstgAdmin
)
1065 admin
.site
.register(rh
.Poste
, PosteAdmin
)
1066 admin
.site
.register(rh
.ResponsableImplantation
, ResponsableImplantationAdmin
)
1067 admin
.site
.register(rh
.Service
, ServiceAdmin
)
1068 admin
.site
.register(rh
.Statut
, StatutAdmin
)
1069 admin
.site
.register(rh
.TauxChange
, TauxChangeAdmin
)
1070 admin
.site
.register(rh
.TypeContrat
, TypeContratAdmin
)
1071 admin
.site
.register(rh
.TypePoste
, TypePosteAdmin
)
1072 admin
.site
.register(rh
.TypeRemuneration
, TypeRemunerationAdmin
)
1073 admin
.site
.register(rh
.TypeRevalorisation
, TypeRevalorisationAdmin
)
1074 admin
.site
.register(rh
.ValeurPoint
, ValeurPointAdmin
)