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 ServiceProxy(rh
.Service
):
22 """ Proxy utilisé pour les organigrammes opar service """
25 verbose_name
= u
"Organigramme par services"
26 verbose_name_plural
= u
"Organigramme par services"
29 class EmployeProxy(rh
.Employe
):
30 """ Proxy utilisé pour les organigrammes des employés """
33 verbose_name
= u
"Organigramme des employés"
34 verbose_name_plural
= u
"Organigramme des employés"
37 class DateRangeMixin(object):
38 prefixe_recherche_temporelle
= ""
40 def get_changelist(self
, request
, **kwargs
):
41 if 'HTTP_REFERER' in request
.META
.keys():
42 referer
= request
.META
['HTTP_REFERER']
43 referer
= "/".join(referer
.split('/')[3:])
44 referer
= "/%s" % referer
.split('?')[0]
45 change_list_view
= 'admin:%s_%s_changelist' % (
46 self
.model
._meta
.app_label
,
47 self
.model
.__name__
.lower(),)
48 if referer
!= reverse(change_list_view
):
49 params
= request
.GET
.copy()
50 params
.update({'statut': 'Actif'})
55 # Override of the InlineModelAdmin to support the link in the tabular inline
56 class LinkedInline(admin
.options
.InlineModelAdmin
):
57 template
= "admin/linked.html"
58 admin_model_path
= None
60 def __init__(self
, *args
):
61 super(LinkedInline
, self
).__init__(*args
)
62 if self
.admin_model_path
is None:
63 self
.admin_model_path
= self
.model
.__name__
.lower()
66 class ProtectRegionMixin(object):
68 def queryset(self
, request
):
69 from dae
.workflow
import grp_drh
, grp_correspondants_rh
70 qs
= super(ProtectRegionMixin
, self
).queryset(request
)
72 if request
.user
.is_superuser
:
75 user_groups
= request
.user
.groups
.all()
77 if grp_drh
in user_groups
:
80 if grp_correspondants_rh
in user_groups
:
81 employe
= get_employe_from_user(request
.user
)
82 q
= Q(**{self
.model
.prefix_implantation
: \
83 employe
.implantation
.region
})
84 qs
= qs
.filter(q
).distinct()
88 def has_change_permission(self
, request
, obj
=None):
89 user_groups
= request
.user
.groups
.all()
91 # Lock pour autoriser uniquement les DRH à utiliser RH
92 if not request
.user
.is_superuser
and not grp_drh
in user_groups
:
95 if len(user_groups
) == 0 and not request
.user
.is_superuser
:
100 ids
= [o
.id for o
in self
.queryset(request
)]
106 class ReadOnlyInlineMixin(object):
108 def get_readonly_fields(self
, request
, obj
=None):
109 return [f
.name
for f
in self
.model
._meta
.fields \
110 if f
.name
not in AUF_METADATA_READONLY_FIELDS
]
113 class AyantDroitInline(AUFMetadataInlineAdminMixin
, admin
.StackedInline
):
114 model
= rh
.AyantDroit
115 form
= AyantDroitForm
122 ('nom_affichage', 'genre'),
130 class AyantDroitCommentaireInline(AUFMetadataInlineAdminMixin
, \
131 admin
.TabularInline
):
132 readonly_fields
= ('owner', )
133 model
= rh
.AyantDroitCommentaire
137 class ContratInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
143 class DossierROInline(ReadOnlyInlineMixin
, LinkedInline
):
144 template
= "admin/rh/dossier/linked.html"
145 exclude
= AUF_METADATA_READONLY_FIELDS
150 def has_add_permission(self
, request
=None):
153 def has_change_permission(self
, request
, obj
=None):
156 def has_delete_permission(self
, request
, obj
=None):
160 class DossierCommentaireInline(AUFMetadataInlineAdminMixin
, \
161 admin
.TabularInline
):
162 readonly_fields
= ('owner', )
163 model
= rh
.DossierCommentaire
167 class DossierPieceInline(admin
.TabularInline
):
168 model
= rh
.DossierPiece
172 class EmployeInline(admin
.TabularInline
):
176 class EmployeCommentaireInline(AUFMetadataInlineAdminMixin
, \
177 admin
.TabularInline
):
178 readonly_fields
= ('owner', )
179 model
= rh
.EmployeCommentaire
183 class EmployePieceInline(admin
.TabularInline
):
184 model
= rh
.EmployePiece
188 class PosteCommentaireInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
189 readonly_fields
= ('owner', )
190 model
= rh
.PosteCommentaire
194 class PosteFinancementInline(admin
.TabularInline
):
195 model
= rh
.PosteFinancement
198 class PostePieceInline(admin
.TabularInline
):
199 model
= rh
.PostePiece
202 class RemunerationInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
203 model
= rh
.Remuneration
207 class RemunerationROInline(ReadOnlyInlineMixin
, RemunerationInline
):
211 class TypePosteInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
215 class PosteComparaisonInline(AUFMetadataInlineAdminMixin
, admin
.TabularInline
):
216 model
= rh
.PosteComparaison
219 class ClassementAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
220 list_display
= ('_classement', '_date_modification', 'user_modification', )
221 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
223 'fields': ('type', 'echelon', 'degre', 'coefficient',)}),
226 def _classement(self
, obj
):
228 _classement
.short_description
= u
"Classement"
230 def _date_modification(self
, obj
):
231 return date(obj
.date_modification
) \
232 if obj
.date_modification
is not None else "(aucune)"
233 _date_modification
.short_description
= u
'date modification'
234 _date_modification
.admin_order_field
= 'date_modification'
237 class CommentaireAdmin(admin
.ModelAdmin
):
241 class DeviseAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
246 '_date_modification',
249 list_filter
= ('archive', )
250 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
252 'fields': ('code', 'nom', 'archive', ),
256 def queryset(self
, request
):
257 return self
.model
._base_manager
259 def _archive(self
, obj
):
264 _archive
.short_description
= u
'Archivé'
266 def _date_modification(self
, obj
):
267 return date(obj
.date_modification
) \
268 if obj
.date_modification
is not None else "(aucune)"
269 _date_modification
.short_description
= u
'date modification'
270 _date_modification
.admin_order_field
= 'date_modification'
273 class DossierAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
274 ProtectRegionMixin
, admin
.ModelAdmin
, AjaxSelect
,):
275 alphabet_filter
= 'employe__nom'
280 'poste__nom_feminin')
289 '_date_modification',
292 list_display_links
= ('_nom',)
294 'poste__implantation__region',
295 'poste__implantation',
296 'poste__type_poste__famille_emploi',
298 'rh_contrats__type_contrat',
300 inlines
= (DossierPieceInline
, ContratInline
,
302 DossierCommentaireInline
,
304 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
310 'organisme_bstg',)}),
315 'remplacement_de', )}),
319 ('regime_travail', 'regime_travail_nb_heure_semaine'),)}),
320 ('Occupation du Poste par cet Employe', {
321 'fields': (('date_debut', 'date_fin'), )}
324 form
= make_ajax_form(rh
.Dossier
, {
325 'employe': 'employes',
327 'remplacement_de': 'dossiers',
330 def lookup_allowed(self
, key
, value
):
332 'employe__nom__istartswith',
333 'poste__implantation__region__id__exact',
334 'poste__implantation__id__exact',
335 'poste__type_poste__id__exact',
336 'poste__type_poste__famille_emploi__id__exact',
337 'rh_contrats__type_contrat__id__exact',
343 _id
.short_description
= u
"#"
344 _id
.admin_order_field
= "id"
347 return "%d : %s %s" % (
349 obj
.employe
.nom
.upper(),
351 _nom
.allow_tags
= True
352 _nom
.short_description
= u
"Dossier"
354 def _apercu(self
, d
):
355 apercu_link
= u
"""<a title="Aperçu du dossier"
356 onclick="return showAddAnotherPopup(this);"
358 <img src="%simg/loupe.png" />
360 (reverse('dossier_apercu', args
=(d
.id,)),
364 _apercu
.allow_tags
= True
365 _apercu
.short_description
= u
""
367 def _date_debut(self
, obj
):
368 return date(obj
.date_debut
)
370 _date_debut
.short_description
= u
'Occupation début'
371 _date_debut
.admin_order_field
= 'date_debut'
373 def _date_fin(self
, obj
):
374 return date(obj
.date_fin
)
375 _date_fin
.short_description
= u
'Occupation fin'
376 _date_fin
.admin_order_field
= 'date_fin'
378 def _date_modification(self
, obj
):
379 return date(obj
.date_modification
) \
380 if obj
.date_modification
is not None else "(aucune)"
381 _date_modification
.short_description
= u
'date modification'
382 _date_modification
.admin_order_field
= 'date_modification'
384 def _poste(self
, dossier
):
385 link
= u
"""<a title="Aperçu du poste"
386 onclick="return showAddAnotherPopup(this);"
387 href='%s'><img src="%simg/loupe.png" />
389 <a href="%s" title="Modifier le poste">%s</a>""" % \
390 (reverse('poste_apercu', args
=(dossier
.poste
.id,)),
392 reverse('admin:rh_poste_change', args
=(dossier
.poste
.id,)),
396 _poste
.allow_tags
= True
397 _poste
.short_description
= u
'Poste'
398 _poste
.admin_order_field
= 'poste__nom'
400 def _employe(self
, obj
):
401 employe
= obj
.employe
402 view_link
= reverse('employe_apercu', args
=(employe
.id,))
403 edit_link
= reverse('admin:rh_employe_change', args
=(employe
.id,))
406 view
= u
"""<a href="%s"
407 title="Aperçu l'employé"
408 onclick="return showAddAnotherPopup(this);">
409 <img src="%simg/loupe.png" />
410 </a>""" % (view_link
, settings
.STATIC_URL
,)
411 return u
"""%s<a href='%s' style="%s;">%s</a>""" % \
412 (view
, edit_link
, style
, employe
)
413 _employe
.allow_tags
= True
414 _employe
.short_description
= u
"Employé"
415 _employe
.admin_order_field
= "employe__nom"
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
.DossierCommentaire
:
421 instance
.owner
= request
.user
422 instance
.date_creation
= datetime
.datetime
.now()
426 class DossierPieceAdmin(admin
.ModelAdmin
):
430 class DossierCommentaireAdmin(admin
.ModelAdmin
):
434 class EmployeAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
435 ProtectRegionMixin
, admin
.ModelAdmin
,):
436 prefixe_recherche_temporelle
= "rh_dossiers__"
437 alphabet_filter
= 'nom'
438 DEFAULT_ALPHABET
= u
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
439 search_fields
= ('id', 'nom', 'prenom', 'nom_affichage', )
441 form
= EmployeAdminForm
447 '_date_modification',
450 list_display_links
= ('_nom',)
452 'rh_dossiers__poste__implantation__region',
453 'rh_dossiers__poste__implantation',
456 inlines
= (AyantDroitInline
,
459 EmployeCommentaireInline
)
460 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
464 ('nom_affichage', 'genre'),
469 ('Informations personnelles', {
470 'fields': ('situation_famille', 'date_entree', )}
474 ('tel_domicile', 'tel_cellulaire'),
475 ('adresse', 'ville'),
476 ('code_postal', 'province'),
482 def _apercu(self
, obj
):
483 return u
"""<a title="Aperçu de l'employé"
484 onclick="return showAddAnotherPopup(this);"
486 <img src="%simg/loupe.png" />
488 (reverse('employe_apercu', args
=(obj
.id,)), settings
.STATIC_URL
)
489 _apercu
.allow_tags
= True
490 _apercu
.short_description
= u
""
493 edit_link
= reverse('admin:rh_employe_change', args
=(obj
.id,))
494 return u
"""<a href='%s'><strong>%s</strong></a>""" % \
495 (edit_link
, "%s %s" % (obj
.nom
.upper(), obj
.prenom
))
496 _nom
.allow_tags
= True
497 _nom
.short_description
= u
"Employé"
498 _nom
.admin_order_field
= "nom"
502 _id
.short_description
= u
"#"
503 _id
.admin_order_field
= "id"
505 def _date_modification(self
, obj
):
506 return date(obj
.date_modification
) \
507 if obj
.date_modification
is not None else "(aucune)"
508 _date_modification
.short_description
= u
'date modification'
509 _date_modification
.admin_order_field
= 'date_modification'
511 def _dossiers_postes(self
, obj
):
513 for d
in obj
.rh_dossiers
.all().order_by('-date_debut'):
514 dossier
= u
"""<a title="Aperçu du dossier"
516 onclick="return showAddAnotherPopup(this);"
517 title="Aperçu du dossier">
518 <img src="%simg/loupe.png" />
520 <a href="%s">Dossier</a>
522 (reverse('dossier_apercu', args
=(d
.id,)),
524 reverse('admin:rh_dossier_change', args
=(d
.id,)))
526 poste
= u
"""<a title="Aperçu du poste"
528 onclick="return showAddAnotherPopup(this);"
529 title="Aperçu du poste">
530 <img src="%simg/loupe.png" />
532 <a href="%s">Poste</a>
534 (reverse('poste_apercu', args
=(d
.poste
.id,)),
536 reverse('admin:rh_poste_change', args
=(d
.poste
.id,)))
537 link
= u
"""<li>%s %s - %s : [%s] %s</li>""" % \
544 # Dossier terminé en gris non cliquable
545 if d
.date_fin
is not None and d
.date_fin
< datetime
.date
.today():
546 link
= u
"""<li style="color: grey">%s : [%s] %s</li>""" % \
553 return "<ul>%s</ul>" % "\n".join(l
)
554 _dossiers_postes
.allow_tags
= True
555 _dossiers_postes
.short_description
= u
"Dossiers et postes"
557 def queryset(self
, request
):
558 qs
= super(EmployeAdmin
, self
).queryset(request
)
559 return qs
.select_related(depth
=1).order_by('nom')
561 def save_formset(self
, request
, form
, formset
, change
):
562 instances
= formset
.save(commit
=False)
563 for instance
in instances
:
564 if instance
.__class__
== rh
.EmployeCommentaire
:
565 instance
.owner
= request
.user
566 instance
.date_creation
= datetime
.datetime
.now()
570 class EmployeProxyAdmin(EmployeAdmin
):
571 list_display
= ('_id', '_apercu', '_nom', '_organigramme')
572 list_display_links
= ('_nom',)
574 def has_add_permission(self
, obj
):
577 def _organigramme(self
, obj
):
579 for d
in obj
.rh_dossiers
.all().order_by('-date_debut'):
580 poste
= u
"""<a title="Aperçu du poste"
582 onclick="return showAddAnotherPopup(this);"
583 title="Aperçu du poste">
584 <img src="%simg/loupe.png" />
586 <a href="%s">Poste</a>
588 (reverse('poste_apercu', args
=(d
.poste
.id,)),
590 reverse('admin:rh_poste_change', args
=(d
.poste
.id,)))
591 organigramme
= u
"""<a href="%s">Organigramme</a>""" % \
592 (reverse('rho_employe', args
=(d
.poste
.id,)))
593 link
= u
"""<li>%s - %s - %s : [%s] %s</li>""" % \
594 (poste
, organigramme
,
600 return "<ul>%s</ul>" % "\n".join(l
)
602 _organigramme
.allow_tags
= True
603 _organigramme
.short_description
= "Organigramme"
606 class EmployeCommentaireAdmin(admin
.ModelAdmin
):
610 class EmployePieceAdmin(admin
.ModelAdmin
):
614 class FamilleEmploiAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
615 list_display
= ('nom', '_date_modification', 'user_modification', )
616 inlines
= (TypePosteInline
,)
617 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
618 (None, {'fields': ('nom', )}),)
620 def _date_modification(self
, obj
):
621 return date(obj
.date_modification
) \
622 if obj
.date_modification
is not None else "(aucune)"
623 _date_modification
.short_description
= u
'date modification'
624 _date_modification
.admin_order_field
= 'date_modification'
627 class OrganismeBstgAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
628 search_fields
= ('nom',)
633 '_date_modification',
636 list_filter
= ('type', )
637 inlines
= (DossierROInline
,)
638 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
639 (None, {'fields': ('nom', 'type', 'pays',)}),
642 def _date_modification(self
, obj
):
643 return date(obj
.date_modification
) \
644 if obj
.date_modification
is not None else "(aucune)"
645 _date_modification
.short_description
= u
'date modification'
646 _date_modification
.admin_order_field
= 'date_modification'
649 class PosteAdmin(DateRangeMixin
, AUFMetadataAdminMixin
, \
650 ProtectRegionMixin
, admin
.ModelAdmin
, AjaxSelect
,):
651 form
= make_ajax_form(rh
.Poste
, {
652 'implantation': 'implantations',
653 'type_poste': 'typepostes',
654 'responsable': 'postes',
655 'valeur_point_min': 'valeurpoints',
656 'valeur_point_max': 'valeurpoints',
658 alphabet_filter
= 'nom'
663 'implantation__region__code',
664 'implantation__region__nom',
665 'rh_dossiers__employe__nom',
666 'rh_dossiers__employe__prenom',
678 '_date_modification',
682 'implantation__region',
686 'type_poste__famille_emploi',
689 list_display_links
= ('_nom',)
690 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
692 ('nom', 'nom_feminin'),
702 'regime_travail_nb_heure_semaine'),
706 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),)}
709 'fields': (('classement_min',
722 ('Comparatifs de rémunération', {
723 'fields': ('devise_comparaison',
724 ('comp_locale_min', 'comp_locale_max'),
725 ('comp_universite_min', 'comp_universite_max'),
726 ('comp_fonctionpub_min', 'comp_fonctionpub_max'),
727 ('comp_ong_min', 'comp_ong_max'),
728 ('comp_autre_min', 'comp_autre_max'))}
731 'fields': ('justification',)}
733 ('Autres Méta-données', {
734 'fields': ('date_debut', 'date_fin')}
738 inlines
= (PosteFinancementInline
,
741 PosteComparaisonInline
,
742 PosteCommentaireInline
, )
744 def lookup_allowed(self
, key
, value
):
747 'date_debut__isnull',
750 'implantation__region__id__exact',
751 'implantation__id__exact',
752 'type_poste__id__exact',
753 'type_poste__famille_emploi__id__exact',
754 'service__id__exact',
761 def _apercu(self
, poste
):
762 view_link
= u
"""<a onclick="return showAddAnotherPopup(this);"
763 title="Aperçu du poste"
765 <img src="%simg/loupe.png" />
767 (reverse('poste_apercu', args
=(poste
.id,)),
768 settings
.STATIC_URL
,)
770 _apercu
.allow_tags
= True
771 _apercu
.short_description
= ''
775 _id
.short_description
= '#'
776 _id
.admin_order_field
= 'id'
778 def _service(self
, obj
):
779 if obj
.service
.supprime
:
780 return """<span style="color:red">%s</span>""" % obj
.service
783 _service
.short_description
= 'Service'
784 _service
.allow_tags
= True
786 def _responsable(self
, obj
):
788 responsable
= u
"""<a href="%s"
789 onclick="return showAddAnotherPopup(this)">
790 <img src="%simg/loupe.png"
791 title="Aperçu du poste" />
795 (reverse('poste_apercu', args
=(obj
.responsable
.id,)),
797 reverse('admin:rh_poste_change', args
=(obj
.responsable
.id,)),
803 employe_id
= obj
.responsable
.rh_dossiers
.all()[0].id
806 onclick="return showAddAnotherPopup(this)">
807 <img src="%simg/loupe.png"
808 title="Aperçu de l'employé">
810 <a href="%s">%s</a>""" % \
811 (reverse('employe_apercu', args
=(employe_id
,)),
813 reverse('admin:rh_employe_change', args
=(employe_id
,)),
818 return "%s %s" % (responsable
, employe
)
819 _responsable
.short_description
= 'Responsable'
820 _responsable
.allow_tags
= True
822 def _nom(self
, poste
):
823 return """<a href="%s">%s</a>""" % \
824 (reverse('admin:rh_poste_change', args
=(poste
.id,)),
826 _nom
.allow_tags
= True
827 _nom
.short_description
= u
'Nom'
828 _nom
.admin_order_field
= 'nom'
830 def _date_modification(self
, obj
):
831 return date(obj
.date_modification
)
832 _date_modification
.short_description
= u
'date modification'
833 _date_modification
.admin_order_field
= 'date_modification'
835 def _occupe_par(self
, obj
):
836 """Formatte la méthode Poste.occupe_par() pour l'admin"""
838 if obj
.date_fin
is not None and obj
.date_fin
< datetime
.date
.now():
840 employes
= obj
.occupe_par()
844 link
= u
"""<a href='%s'
845 title='Aperçu de l\'employer'
846 onclick='return showAddAnotherPopup(this)'>
847 <img src='%simg/loupe.png' />
849 <a href='%s'>%s</a>""" % \
850 (reverse('employe_apercu', args
=(e
.id,)),
852 reverse('admin:rh_employe_change', args
=(e
.id,)),
855 output
= "\n<br />".join(l
)
857 _occupe_par
.allow_tags
= True
858 _occupe_par
.short_description
= "Occupé par"
860 def save_formset(self
, request
, form
, formset
, change
):
861 instances
= formset
.save(commit
=False)
862 for instance
in instances
:
863 if instance
.__class__
== rh
.PosteCommentaire
:
864 instance
.owner
= request
.user
865 instance
.date_creation
= datetime
.datetime
.now()
870 class PosteCommentaireAdmin(admin
.ModelAdmin
):
874 class PosteFinancementAdmin(admin
.ModelAdmin
):
878 class PostePieceAdmin(admin
.ModelAdmin
):
882 class RemunerationAdmin(admin
.ModelAdmin
):
886 class ResponsableImplantationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
887 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
889 'fields': ('employe', 'implantation', ),
894 class ServiceAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
898 '_date_modification',
901 list_filter
= ('archive', )
902 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
904 'fields': ('nom', 'archive', ),
908 def _archive(self
, obj
):
913 _archive
.short_description
= u
'Archivé'
915 def _date_modification(self
, obj
):
916 return date(obj
.date_modification
) \
917 if obj
.date_modification
is not None else "(aucune)"
918 _date_modification
.short_description
= u
'date modification'
919 _date_modification
.admin_order_field
= 'date_modification'
922 class ServiceProxyAdmin(ServiceAdmin
):
923 list_display
= ('nom', '_organigramme')
924 list_display_links
= ('nom',)
926 def has_add_permission(self
, obj
):
929 def _organigramme(self
, obj
):
930 return """<a href="%s">Organigramme</a>""" % (reverse('rho_service', args
=(obj
.id,)))
931 _organigramme
.allow_tags
= True
932 _organigramme
.short_description
= "Organigramme"
934 class StatutAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
935 list_display
= ('code', 'nom', '_date_modification', 'user_modification', )
936 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
938 'fields': ('code', 'nom', ),
942 def _date_modification(self
, obj
):
943 return date(obj
.date_modification
) \
944 if obj
.date_modification
is not None else "(aucune)"
945 _date_modification
.short_description
= u
'date modification'
946 _date_modification
.admin_order_field
= 'date_modification'
949 class TauxChangeAdmin(admin
.ModelAdmin
):
954 '_date_modification',
957 list_filter
= ('devise', )
958 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
960 'fields': ('taux', 'devise', 'annee', ),
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 TypeContratAdmin(admin
.ModelAdmin
):
975 '_date_modification',
978 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
980 'fields': ('nom', 'nom_long', ),
984 def _date_modification(self
, obj
):
985 return date(obj
.date_modification
) \
986 if obj
.date_modification
is not None else "(aucune)"
987 _date_modification
.short_description
= u
'date modification'
988 _date_modification
.admin_order_field
= 'date_modification'
991 class TypePosteAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
992 search_fields
= ('nom', 'nom_feminin', )
996 '_date_modification',
999 list_filter
= ('famille_emploi', )
1000 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1011 def _date_modification(self
, obj
):
1012 return date(obj
.date_modification
) \
1013 if obj
.date_modification
is not None else "(aucune)"
1014 _date_modification
.short_description
= u
'date modification'
1015 _date_modification
.admin_order_field
= 'date_modification'
1018 class TypeRemunerationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1022 'nature_remuneration',
1023 '_date_modification',
1024 'user_modification',)
1025 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1026 (None, {'fields': ('nom', 'type_paiement', 'nature_remuneration',)}),
1029 def _date_modification(self
, obj
):
1030 return date(obj
.date_modification
) \
1031 if obj
.date_modification
is not None else "(aucune)"
1032 _date_modification
.short_description
= u
'date modification'
1033 _date_modification
.admin_order_field
= 'date_modification'
1036 class TypeRevalorisationAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1037 list_display
= ('nom', '_date_modification', 'user_modification', )
1038 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1039 (None, {'fields': ('nom', )}),
1042 def _date_modification(self
, obj
):
1043 return date(obj
.date_modification
) \
1044 if obj
.date_modification
is not None else "(aucune)"
1045 _date_modification
.short_description
= u
'date modification'
1046 _date_modification
.admin_order_field
= 'date_modification'
1049 class ValeurPointAdmin(AUFMetadataAdminMixin
, admin
.ModelAdmin
):
1055 '_date_modification',
1056 'user_modification',
1058 list_filter
= ('annee', 'devise', )
1059 fieldsets
= AUFMetadataAdminMixin
.fieldsets
+ (
1060 (None, {'fields': ('valeur', 'devise', 'implantation', 'annee', )}),
1063 def _date_modification(self
, obj
):
1064 return date(obj
.date_modification
) \
1065 if obj
.date_modification
is not None else "(aucune)"
1066 _date_modification
.short_description
= u
'date modification'
1067 _date_modification
.admin_order_field
= 'date_modification'
1069 def _devise_code(self
, obj
):
1070 return obj
.devise
.code
1071 _devise_code
.short_description
= "Code de la devise"
1073 def _devise_nom(self
, obj
):
1074 return obj
.devise
.nom
1075 _devise_nom
.short_description
= "Nom de la devise"
1078 admin
.site
.register(rh
.Classement
, ClassementAdmin
)
1079 admin
.site
.register(rh
.Devise
, DeviseAdmin
)
1080 admin
.site
.register(rh
.Dossier
, DossierAdmin
)
1081 admin
.site
.register(EmployeProxy
, EmployeProxyAdmin
)
1082 admin
.site
.register(ServiceProxy
, ServiceProxyAdmin
)
1083 admin
.site
.register(rh
.Employe
, EmployeAdmin
)
1084 admin
.site
.register(rh
.FamilleEmploi
, FamilleEmploiAdmin
)
1085 admin
.site
.register(rh
.OrganismeBstg
, OrganismeBstgAdmin
)
1086 admin
.site
.register(rh
.Poste
, PosteAdmin
)
1087 admin
.site
.register(rh
.ResponsableImplantation
, ResponsableImplantationAdmin
)
1088 admin
.site
.register(rh
.Service
, ServiceAdmin
)
1089 admin
.site
.register(rh
.Statut
, StatutAdmin
)
1090 admin
.site
.register(rh
.TauxChange
, TauxChangeAdmin
)
1091 admin
.site
.register(rh
.TypeContrat
, TypeContratAdmin
)
1092 admin
.site
.register(rh
.TypePoste
, TypePosteAdmin
)
1093 admin
.site
.register(rh
.TypeRemuneration
, TypeRemunerationAdmin
)
1094 admin
.site
.register(rh
.TypeRevalorisation
, TypeRevalorisationAdmin
)
1095 admin
.site
.register(rh
.ValeurPoint
, ValeurPointAdmin
)