Commit | Line | Data |
---|---|---|
6e7c919b NC |
1 | # -*- encoding: utf-8 -*- |
2 | ||
8d3e2fff PP |
3 | from collections import defaultdict |
4 | import datetime | |
5 | ||
babf71ec | 6 | from django.db import models |
6e7c919b | 7 | from django.contrib import admin |
49449367 | 8 | from django.conf import settings |
aff1a4c6 | 9 | from django.db.models import Q |
d6985a3a | 10 | from auf.django.metadata.admin import AUFMetadataAdminMixin, AUFMetadataInlineAdminMixin, AUF_METADATA_READONLY_FIELDS |
babf71ec | 11 | from project.rh import models as rh |
84cbb4c5 | 12 | from forms import DossierForm, ContratForm |
aff1a4c6 PP |
13 | from dae.utils import get_employe_from_user |
14 | ||
15 | ||
16 | class ProtectRegionMixin(object): | |
17 | ||
18 | def queryset(self, request): | |
19 | qs = super(ProtectRegionMixin, self).queryset(request) | |
20 | ||
21 | if request.user.is_superuser: | |
22 | return qs | |
23 | ||
24 | employe = get_employe_from_user(request.user) | |
25 | ||
26 | q = Q(**{self.model.prefix_implantation: employe.implantation.region}) | |
27 | qs = qs.filter(q).distinct() | |
28 | return qs | |
29 | ||
30 | def has_change_permission(self, request, obj=None): | |
31 | if request.user.is_superuser: | |
32 | return True | |
33 | ||
34 | if obj: | |
35 | employe = get_employe_from_user(request.user) | |
36 | if employe.implantation.region in obj.get_regions(): | |
37 | return True | |
38 | else: | |
39 | return False | |
40 | ||
41 | return True | |
42 | ||
6e7c919b | 43 | |
d6985a3a | 44 | # Inlines |
6e7c919b | 45 | |
d6985a3a OL |
46 | class ReadOnlyInlineMixin(object): |
47 | def get_readonly_fields(self, request, obj=None): | |
48 | return [f.name for f in self.model._meta.fields if f.name not in AUF_METADATA_READONLY_FIELDS] | |
6e7c919b NC |
49 | |
50 | ||
51ab4c2c | 51 | class AyantDroitInline(AUFMetadataInlineAdminMixin, admin.StackedInline): |
babf71ec | 52 | model = models.Model # à remplacer dans admin.py |
51ab4c2c | 53 | extra = 0 |
54d04eed | 54 | |
972f50e4 PP |
55 | fieldsets = ( |
56 | (None, { | |
57 | 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', 'lien_parente', ) | |
58 | }), | |
59 | ) | |
60 | ||
d6985a3a OL |
61 | |
62 | class AyantDroitCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline): | |
cf786fb2 | 63 | readonly_fields = ('owner', ) |
babf71ec | 64 | model = models.Model # à remplacer dans admin.py |
cf786fb2 | 65 | extra = 1 |
6e7c919b | 66 | |
54d04eed | 67 | |
d6985a3a | 68 | class ContratInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
84cbb4c5 | 69 | form = ContratForm |
babf71ec | 70 | model = models.Model # à remplacer dans admin.py |
1f2979b8 | 71 | extra = 1 |
babf71ec NC |
72 | |
73 | ||
d6985a3a OL |
74 | class DossierROInline(ReadOnlyInlineMixin, admin.TabularInline): |
75 | exclude = AUF_METADATA_READONLY_FIELDS | |
babf71ec | 76 | model = models.Model # à remplacer dans admin.py |
babf71ec | 77 | |
d6985a3a OL |
78 | |
79 | class DossierCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline): | |
1f2979b8 | 80 | readonly_fields = ('owner', ) |
babf71ec | 81 | model = models.Model # à remplacer dans admin.py |
1f2979b8 | 82 | extra = 1 |
babf71ec | 83 | |
d6985a3a | 84 | |
babf71ec NC |
85 | class DossierPieceInline(admin.TabularInline): |
86 | model = models.Model # à remplacer dans admin.py | |
988af3fb | 87 | extra = 4 |
babf71ec NC |
88 | |
89 | ||
90 | class EmployeInline(admin.TabularInline): | |
91 | model = models.Model # à remplacer dans admin.py | |
92 | ||
d6985a3a | 93 | class EmployeCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
cf786fb2 | 94 | readonly_fields = ('owner', ) |
babf71ec | 95 | model = models.Model # à remplacer dans admin.py |
cf786fb2 | 96 | extra = 1 |
babf71ec NC |
97 | |
98 | ||
99 | class EmployePieceInline(admin.TabularInline): | |
100 | model = models.Model # à remplacer dans admin.py | |
988af3fb | 101 | extra = 4 |
babf71ec NC |
102 | |
103 | ||
d6985a3a | 104 | class EvenementInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
babf71ec | 105 | model = models.Model # à remplacer dans admin.py |
1f2979b8 | 106 | extra = 1 |
babf71ec NC |
107 | |
108 | ||
d6985a3a | 109 | class EvenementRemunerationInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
babf71ec | 110 | model = models.Model # à remplacer dans admin.py |
1f2979b8 | 111 | extra = 1 |
babf71ec NC |
112 | |
113 | ||
d6985a3a | 114 | class PosteCommentaireInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
70561dc2 | 115 | readonly_fields = ('owner', ) |
babf71ec | 116 | model = models.Model # à remplacer dans admin.py |
70561dc2 | 117 | extra = 1 |
babf71ec NC |
118 | |
119 | ||
120 | class PosteFinancementInline(admin.TabularInline): | |
121 | model = models.Model # à remplacer dans admin.py | |
122 | ||
123 | ||
124 | class PostePieceInline(admin.TabularInline): | |
125 | model = models.Model # à remplacer dans admin.py | |
126 | ||
127 | ||
d6985a3a | 128 | class RemunerationInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
babf71ec | 129 | model = models.Model # à remplacer dans admin.py |
1f2979b8 | 130 | extra = 1 |
babf71ec NC |
131 | |
132 | ||
d6985a3a | 133 | class RemunerationROInline(ReadOnlyInlineMixin, RemunerationInline): |
6e7c919b NC |
134 | pass |
135 | ||
54d04eed | 136 | |
26dacccc | 137 | class TypePosteInline(AUFMetadataInlineAdminMixin, admin.TabularInline): |
babf71ec NC |
138 | model = models.Model # à remplacer dans admin.py |
139 | ||
140 | ||
141 | # Admins | |
142 | ||
aff1a4c6 | 143 | class AyantDroitAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin): |
cf786fb2 OL |
144 | """ |
145 | L'ajout d'un nouvel ayantdroit se fait dans l'admin de l'employé. | |
146 | """ | |
387ab827 | 147 | alphabet_filter = 'nom' |
cf786fb2 | 148 | search_fields = ('nom', 'prenom', 'employe__nom', 'employe__prenom', ) |
1a89b1f3 | 149 | list_display = ('_employe', 'lien_parente', '_ayantdroit', ) |
babf71ec | 150 | inlines = (AyantDroitCommentaireInline,) |
d6985a3a OL |
151 | readonly_fields = AUFMetadataAdminMixin.readonly_fields + ('employe',) |
152 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
cf786fb2 | 153 | ("Lien avec l'employé", { |
76e26dfc | 154 | 'fields': (('employe', 'lien_parente'), ) |
cf786fb2 OL |
155 | }), |
156 | ||
157 | ('Identification', { | |
76e26dfc | 158 | 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', ) |
cf786fb2 OL |
159 | }), |
160 | ) | |
161 | ||
162 | def save_formset(self, request, form, formset, change): | |
163 | instances = formset.save(commit=False) | |
164 | for instance in instances: | |
165 | if instance.__class__ == rh.AyantDroitCommentaire: | |
166 | instance.owner = request.user | |
167 | instance.save() | |
cf786fb2 OL |
168 | |
169 | def _ayantdroit(self, obj): | |
170 | return unicode(obj) | |
171 | _ayantdroit.short_description = u'Ayant droit' | |
babf71ec | 172 | |
cf786fb2 OL |
173 | def _employe(self, obj): |
174 | return unicode(obj.employe) | |
175 | _employe.short_description = u'Employé' | |
176 | ||
177 | def has_add_permission(self, request): | |
178 | return False | |
babf71ec NC |
179 | |
180 | class AyantDroitCommentaireAdmin(admin.ModelAdmin): | |
6e7c919b NC |
181 | pass |
182 | ||
54d04eed | 183 | |
324bf312 OL |
184 | class ClassementAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
185 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
186 | (None, { | |
187 | 'fields': ('type', 'echelon', 'degre', 'coefficient', ) | |
188 | }), | |
189 | ) | |
190 | ||
6e7c919b | 191 | |
6e7c919b NC |
192 | class CommentaireAdmin(admin.ModelAdmin): |
193 | pass | |
194 | ||
195 | ||
84cbb4c5 OL |
196 | #class ContratAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
197 | # form = ContratForm | |
198 | # alphabet_filter = 'dossier__employe__nom' | |
199 | # search_fields = ('dossier__employe__nom', 'dossier__employe__prenom', 'dossier__poste__nom', 'dossier__poste__nom_feminin', ) | |
200 | # list_display = ('id', '_employe', '_poste', 'date_debut', 'date_fin', '_implantation', ) | |
201 | # fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
202 | # (None, { | |
203 | # 'fields': ('dossier', 'type_contrat', 'date_debut', 'date_fin', ) | |
204 | # }), | |
205 | # ) | |
206 | # | |
207 | # def lookup_allowed(self, key, value): | |
208 | # if key in ('dossier__employe__nom__istartswith', ): | |
209 | # return True | |
210 | # | |
211 | # def _employe(self, obj): | |
212 | # return unicode(obj.dossier.employe) | |
213 | # _employe.short_description = "Employé" | |
214 | # | |
215 | # def _poste(self, obj): | |
216 | # return obj.dossier.poste.nom | |
217 | # _poste.short_description = "Poste" | |
218 | # | |
219 | # def _implantation(self, obj): | |
220 | # return obj.dossier.poste.implantation | |
221 | # _poste.short_description = "Implantation" | |
54d04eed | 222 | |
84fc088b OL |
223 | class DeviseAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
224 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
225 | (None, { | |
226 | 'fields': ('code', 'nom', ), | |
227 | }), | |
228 | ) | |
6e7c919b | 229 | |
54d04eed | 230 | |
aff1a4c6 | 231 | class DossierAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin,): |
84cbb4c5 | 232 | form = DossierForm |
387ab827 | 233 | alphabet_filter = 'employe__nom' |
d8d7985b | 234 | search_fields = ('employe__nom', 'employe__prenom', 'poste__nom', 'poste__nom_feminin') |
55ca522c | 235 | list_display = ('_employe', '_poste', 'date_debut', 'date_fin', 'date_modification', '_actif') |
1f2979b8 | 236 | inlines = (DossierPieceInline, ContratInline, |
cf786fb2 OL |
237 | RemunerationInline, |
238 | #EvenementInline, | |
239 | DossierCommentaireInline, | |
1f2979b8 | 240 | ) |
d6985a3a | 241 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
1f2979b8 OL |
242 | ('Identification', { |
243 | 'fields': ('employe', 'poste', 'statut', 'organisme_bstg',) | |
244 | }), | |
245 | ('Recrutement', { | |
cb962802 | 246 | 'fields': (('remplacement', 'statut_residence'), ) |
1f2979b8 OL |
247 | }), |
248 | ('Rémunération', { | |
cb962802 | 249 | 'fields': ('classement', ('regime_travail', 'regime_travail_nb_heure_semaine'),) |
1f2979b8 OL |
250 | }), |
251 | ('Occupation du Poste par cet Employe', { | |
cb962802 | 252 | 'fields': (('date_debut', 'date_fin'), ) |
1f2979b8 OL |
253 | }), |
254 | ) | |
54d04eed | 255 | |
387ab827 | 256 | def lookup_allowed(self, key, value): |
49449367 | 257 | if key in ('employe__nom__istartswith', 'actif__exact', ): |
387ab827 OL |
258 | return True |
259 | ||
49449367 OL |
260 | def _actif(self, dossier): |
261 | if dossier.employe.actif: | |
262 | html = """<img alt="True" src="%simg/admin/icon-yes.gif">""" | |
263 | else: | |
264 | html = """<img alt="False" src="%simg/admin/icon-no.gif">""" | |
265 | return html % settings.ADMIN_MEDIA_PREFIX | |
266 | _actif.allow_tags = u'Employé actif' | |
267 | _actif.short_description = u'Employé actif' | |
268 | _actif.admin_order_field = 'employe__actif' | |
387ab827 | 269 | |
54d04eed NC |
270 | def _poste(self, dossier): |
271 | return unicode(dossier.poste.nom) | |
272 | _poste.short_description = u'Poste' | |
d9836879 | 273 | _poste.admin_order_field = 'poste__nom' |
54d04eed NC |
274 | |
275 | def _employe(self, dossier): | |
276 | return unicode(dossier.employe) | |
277 | _employe.short_description = u'Employé' | |
d9836879 OL |
278 | _employe.admin_order_field = 'employe__nom' |
279 | ||
1f2979b8 OL |
280 | def save_formset(self, request, form, formset, change): |
281 | instances = formset.save(commit=False) | |
282 | for instance in instances: | |
283 | if instance.__class__ == rh.DossierCommentaire: | |
284 | instance.owner = request.user | |
285 | instance.save() | |
6e7c919b | 286 | |
8d3e2fff PP |
287 | def render_change_form(self, request, context, *args, **kwargs): |
288 | obj = kwargs['obj'] | |
289 | ||
290 | thisyear = datetime.date.today().year | |
291 | thisyearfilter = Q(date_debut__year=thisyear) | Q(date_fin__year=thisyear) | |
292 | ||
293 | remunnow = obj.rh_remuneration_remunerations.filter(thisyearfilter) | |
294 | ||
295 | remun_sum = 0 | |
296 | remun_sum_euro = 0 | |
297 | sums = defaultdict(int) | |
298 | sums_euro = defaultdict(int) | |
299 | for r in remunnow: | |
300 | nature = r.type.nature_remuneration | |
301 | sums[nature] += r.montant | |
302 | sums_euro[nature] += r.montant_euro() | |
303 | remun_sum += r.montant | |
304 | remun_sum_euro += r.montant_euro() | |
305 | ||
306 | remun = {} | |
307 | sums = dict(sums) | |
308 | for n, s in sums.iteritems(): | |
309 | remun[n] = [sums[n], sums_euro[n]] | |
310 | ||
311 | extra = { | |
312 | 'remun': remun, | |
313 | 'remun_sum': remun_sum, | |
314 | 'remun_sum_euro': remun_sum_euro, | |
315 | } | |
316 | ||
317 | context.update(extra) | |
318 | ||
319 | return super(DossierAdmin, self).render_change_form(request, context, *args, **kwargs) | |
320 | ||
321 | ||
6e7c919b NC |
322 | class DossierPieceAdmin(admin.ModelAdmin): |
323 | pass | |
324 | ||
54d04eed | 325 | |
6e7c919b NC |
326 | class DossierCommentaireAdmin(admin.ModelAdmin): |
327 | pass | |
328 | ||
54d04eed | 329 | |
aff1a4c6 | 330 | class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin): |
7ffc5aa4 | 331 | alphabet_filter = 'nom' |
49449367 OL |
332 | search_fields = ('id', 'nom', 'prenom', 'nom_affichage', 'actif', ) |
333 | list_filter = ('actif', ) | |
334 | ordering = ('nom', ) | |
335 | actions = ('desactiver', ) | |
336 | list_display = ('nom', 'prenom', 'actif', ) | |
babf71ec NC |
337 | inlines = (AyantDroitInline, |
338 | DossierROInline, | |
339 | EmployePieceInline, | |
340 | EmployeCommentaireInline) | |
d6985a3a | 341 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
cf786fb2 | 342 | ('Identification', { |
e35610f5 | 343 | 'fields': (('nom', 'prenom'), ('nom_affichage', 'genre'), 'nationalite', 'date_naissance', ) |
cf786fb2 OL |
344 | }), |
345 | ('Informations personnelles', { | |
346 | 'fields': ('situation_famille', 'date_entree', ) | |
347 | }), | |
348 | ('Coordonnées', { | |
e35610f5 | 349 | 'fields': (('tel_domicile', 'tel_cellulaire'), ('adresse', 'ville'), ('code_postal', 'province'), 'pays', ) |
cf786fb2 OL |
350 | }), |
351 | ) | |
babf71ec | 352 | |
cf786fb2 OL |
353 | def save_formset(self, request, form, formset, change): |
354 | instances = formset.save(commit=False) | |
355 | for instance in instances: | |
356 | if instance.__class__ == rh.EmployeCommentaire: | |
357 | instance.owner = request.user | |
358 | instance.save() | |
babf71ec NC |
359 | |
360 | class EmployeCommentaireAdmin(admin.ModelAdmin): | |
6e7c919b NC |
361 | pass |
362 | ||
54d04eed | 363 | |
babf71ec | 364 | class EmployePieceAdmin(admin.ModelAdmin): |
6e7c919b NC |
365 | pass |
366 | ||
54d04eed | 367 | |
6e7c919b | 368 | class EvenementAdmin(admin.ModelAdmin): |
babf71ec | 369 | inlines = (EvenementRemunerationInline,) |
6e7c919b | 370 | |
54d04eed | 371 | |
6e7c919b NC |
372 | class EvenementRemunerationAdmin(admin.ModelAdmin): |
373 | pass | |
374 | ||
54d04eed | 375 | |
26dacccc | 376 | class FamilleEmploiAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
babf71ec | 377 | inlines = (TypePosteInline,) |
26dacccc OL |
378 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
379 | (None, { | |
380 | 'fields': ('nom', ) | |
381 | }), | |
382 | ) | |
6e7c919b | 383 | |
54d04eed | 384 | |
aff1a4c6 | 385 | class OrganismeBstgAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin): |
d8d7985b | 386 | search_fields = ('nom', ) |
1c8856ef | 387 | list_display = ('nom', 'type', 'pays', ) |
babf71ec | 388 | inlines = (DossierROInline,) |
43f5653a OL |
389 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
390 | (None, { | |
391 | 'fields': ('nom', 'type', 'pays', ) | |
392 | }), | |
393 | ) | |
6e7c919b | 394 | |
54d04eed | 395 | |
aff1a4c6 | 396 | class PosteAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin): |
387ab827 | 397 | alphabet_filter = 'nom' |
70561dc2 OL |
398 | search_fields = ('nom', 'implantation__code', 'implantation__nom', 'implantation__region__code', 'implantation__region__nom', ) |
399 | list_display = ('nom', 'implantation', 'service', 'type_poste', 'date_debut', 'date_fin', ) | |
d2cf315a | 400 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
6e7c919b | 401 | (None, { |
4497b3cb | 402 | 'fields': (('nom', 'nom_feminin'), 'implantation', 'type_poste', |
6e7c919b NC |
403 | 'service', 'responsable') |
404 | }), | |
405 | ('Contrat', { | |
4497b3cb | 406 | 'fields': (('regime_travail', 'regime_travail_nb_heure_semaine'), ) |
6e7c919b NC |
407 | }), |
408 | ('Recrutement', { | |
4497b3cb | 409 | 'fields': (('local', 'expatrie', 'mise_a_disposition', 'appel'),) |
6e7c919b NC |
410 | }), |
411 | ('Rémunération', { | |
4497b3cb PP |
412 | 'fields': (('classement_min', 'classement_max'), |
413 | ('valeur_point_min', 'valeur_point_max'), | |
414 | ('devise_min', 'devise_max'), | |
415 | ('salaire_min', 'salaire_max'), | |
416 | ('indemn_min', 'indemn_max'), | |
417 | ('autre_min', 'autre_max')) | |
6e7c919b NC |
418 | }), |
419 | ('Comparatifs de rémunération', { | |
4497b3cb PP |
420 | 'fields': ('devise_comparaison', |
421 | ('comp_locale_min', 'comp_locale_max'), | |
422 | ('comp_universite_min', 'comp_universite_max'), | |
423 | ('comp_fonctionpub_min', 'comp_fonctionpub_max'), | |
424 | ('comp_ong_min', 'comp_ong_max'), | |
425 | ('comp_autre_min', 'comp_autre_max')) | |
6e7c919b NC |
426 | }), |
427 | ('Justification', { | |
428 | 'fields': ('justification',) | |
429 | }), | |
430 | ('Autres Metadata', { | |
4497b3cb | 431 | 'fields': ('date_validation', ('date_debut', 'date_fin')) |
6e7c919b NC |
432 | }), |
433 | ) | |
434 | ||
babf71ec NC |
435 | inlines = (PosteFinancementInline, |
436 | PostePieceInline, | |
70561dc2 OL |
437 | DossierROInline, |
438 | PosteCommentaireInline, ) | |
6e7c919b | 439 | |
70561dc2 OL |
440 | def save_formset(self, request, form, formset, change): |
441 | instances = formset.save(commit=False) | |
442 | for instance in instances: | |
443 | if instance.__class__ == rh.PosteCommentaire: | |
444 | instance.owner = request.user | |
445 | instance.save() | |
446 | formset.save_m2m() | |
6e7c919b | 447 | |
aff1a4c6 | 448 | |
6e7c919b NC |
449 | class PosteCommentaireAdmin(admin.ModelAdmin): |
450 | pass | |
451 | ||
6e7c919b | 452 | |
babf71ec | 453 | class PosteFinancementAdmin(admin.ModelAdmin): |
6e7c919b NC |
454 | pass |
455 | ||
6e7c919b | 456 | |
babf71ec | 457 | class PostePieceAdmin(admin.ModelAdmin): |
6e7c919b NC |
458 | pass |
459 | ||
6e7c919b | 460 | |
babf71ec | 461 | class RemunerationAdmin(admin.ModelAdmin): |
6e7c919b NC |
462 | pass |
463 | ||
6e7c919b | 464 | |
1eede0db OL |
465 | class ResponsableImplantationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
466 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
467 | (None, { | |
468 | 'fields': ('employe', 'implantation', ), | |
469 | }), | |
470 | ) | |
471 | ||
6e7c919b | 472 | |
43f5653a OL |
473 | class ServiceAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
474 | list_display = ('nom', 'actif', ) | |
475 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
476 | (None, { | |
477 | 'fields': ('nom', ), | |
478 | }), | |
479 | ) | |
6e7c919b | 480 | |
43f5653a OL |
481 | class StatutAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
482 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
483 | (None, { | |
484 | 'fields': ('code', 'nom', ), | |
485 | }), | |
486 | ) | |
6e7c919b | 487 | |
babf71ec | 488 | class TauxChangeAdmin(admin.ModelAdmin): |
24475cf1 OL |
489 | list_display = ('taux', 'devise', 'annee', ) |
490 | list_filter = ('devise', ) | |
dcbadfad OL |
491 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
492 | (None, { | |
493 | 'fields': ('taux', 'devise', 'annee', ), | |
494 | }), | |
495 | ) | |
6e7c919b | 496 | |
6e7c919b | 497 | class TypeContratAdmin(admin.ModelAdmin): |
babf71ec | 498 | inlines = (ContratInline,) |
6e7c919b | 499 | |
6e7c919b | 500 | |
240893cb | 501 | class TypePosteAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
d8d7985b | 502 | search_fields = ('nom', 'nom_feminin', ) |
52e05b08 OL |
503 | list_display = ('nom', 'famille_emploi', ) |
504 | list_filter = ('famille_emploi', ) | |
240893cb OL |
505 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
506 | (None, { | |
507 | 'fields': ('nom', 'nom_feminin', 'is_responsable', 'famille_emploi', ) | |
508 | }), | |
509 | ) | |
6e7c919b | 510 | |
6e7c919b | 511 | |
3f486b41 | 512 | class TypeRemunerationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
f7efd29a | 513 | list_display = ('nom', 'type_paiement', 'nature_remuneration', ) |
3f486b41 OL |
514 | #inlines = (RemunerationROInline,) utilité? |
515 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
516 | (None, { | |
517 | 'fields': ('nom', 'type_paiement', 'nature_remuneration', ) | |
518 | }), | |
519 | ) | |
6e7c919b | 520 | |
6e7c919b | 521 | |
3f486b41 OL |
522 | class TypeRevalorisationAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
523 | #inlines = (RemunerationROInline,) utilité? | |
524 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( | |
525 | (None, { | |
526 | 'fields': ('nom', ) | |
527 | }), | |
528 | ) | |
6e7c919b | 529 | |
6e7c919b | 530 | |
84fc088b | 531 | class ValeurPointAdmin(AUFMetadataAdminMixin, admin.ModelAdmin): |
701f3bea | 532 | list_display = ('_devise_code', '_devise_nom', 'annee', 'valeur', ) |
84fc088b OL |
533 | fieldsets = AUFMetadataAdminMixin.fieldsets + ( |
534 | (None, { | |
535 | 'fields': ('valeur', 'devise', 'implantation', 'annee', ) | |
536 | }), | |
537 | ) | |
701f3bea OL |
538 | |
539 | def _devise_code(self, obj): | |
540 | return obj.devise.code | |
541 | _devise_code.short_description = "Code de la devise" | |
542 | ||
543 | def _devise_nom(self, obj): | |
544 | return obj.devise.nom | |
545 | _devise_nom.short_description = "Nom de la devise" |