merge master
[auf_rh_dae.git] / project / menu.py
CommitLineData
e2c0b1ac
PP
1# -*- coding: utf-8 -*-
2
6f38ca31
PP
3"""
4This file was generated with the custommenu management command, it contains
5the classes for the admin menu, you can customize this class as you want.
6
7To activate your custom menu add the following to your settings.py::
8 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
9"""
10
11from django.core.urlresolvers import reverse
12from django.utils.translation import ugettext_lazy as _
13
14from admin_tools.menu import items, Menu
018c8eaf
DB
15
16from project.decorators import in_drh_or_admin
6f38ca31 17
fb4ded65 18
6f38ca31
PP
19class CustomMenu(Menu):
20 """
21 Custom Menu for project admin site.
22 """
fb4ded65 23
6f38ca31
PP
24 def __init__(self, **kwargs):
25 Menu.__init__(self, **kwargs)
26 self.children += [
27 items.MenuItem(_('Dashboard'), reverse('admin:index')),
d53e80f7 28 #items.Bookmarks(),
83ebc284
PP
29 #items.AppList(
30 # _('Applications'),
31 # exclude=('django.contrib.*', 'project.rh.models.EmployeProxy')
32 #),
6f38ca31
PP
33 items.AppList(
34 _('Administration'),
fb4ded65 35 models=('django.contrib.*',))]
6f38ca31
PP
36
37 def init_with_context(self, context):
38 """
39 Use this method if you need to access the request context.
40 """
595ad88d 41 request = context['request']
fb4ded65
OL
42
43 if request.user.is_superuser:
44 self.children += [
45 items.MenuItem('DAE', reverse('admin:app_list',
46 kwargs={'app_label': 'dae'})),
47 ]
48
a12ddd52 49 if in_drh_or_admin(request.user):
595ad88d
OL
50 self.children += [
51 items.MenuItem('Rapports',
fb4ded65
OL
52 children=[
53 #items.MenuItem('Rapport des postes',
54 # reverse('rhr_postes')),
55 items.MenuItem('Rapport des contrats',
56 reverse('rhr_contrats')),
57 items.MenuItem(u'Rapport des employés sans contrat',
58 reverse('rhr_employe_sans_contrat')),
59 #items.MenuItem('Rapport de rémunération',
60 # reverse('rhr_remuneration')),
61
62 # A corriger
63 #items.MenuItem('Rapport des postes par service',
64 # reverse('rhr_postes_service')),
65 #items.MenuItem('Rapport des postes par implantation',
66 # reverse('rhr_postes_implantation')),
67
68 #items.MenuItem('Modelisation des postes',
69 # reverse('rhr_postes_modelisation')),
70 #items.MenuItem('Rapport hiérarchique des postes',
71 # reverse('rhr_postes_hierarchie')),
72 items.MenuItem('Rapport de masse salariale',
73 reverse('rhr_masse_salariale')),
74 ]),
fdfa21cc 75
08faf06e
JPC
76 items.MenuItem('Organigrammes',
77 children=[
fb4ded65
OL
78 items.MenuItem('Organigramme par employé',
79 reverse('admin:rh_employeproxy_changelist')),
80 items.MenuItem('Organigramme par service',
81 reverse('admin:rh_serviceproxy_changelist')),
82 items.MenuItem('Organigramme par implantation',
83 reverse('admin:rh_implantationproxy_changelist')),
84 items.MenuItem('Organigramme par bureau',
85 reverse('admin:rh_regionproxy_changelist')),
86 ]),
337c42e0
PP
87 items.MenuItem('Requêtes',
88 children=[
fb4ded65
OL
89 items.MenuItem('Requêtes sauvegardées',
90 reverse('admin:django_qbe_savedquery_changelist')),
91 items.MenuItem('Constructeur de requêtes',
92 reverse('qbe_form')),
93 ]),
595ad88d
OL
94 ]
95 super(CustomMenu, self).init_with_context(context)