rapport modif + widget
[auf_rh_dae.git] / project / menu.py
1 # -*- coding: utf-8 -*-
2
3 """
4 This file was generated with the custommenu management command, it contains
5 the classes for the admin menu, you can customize this class as you want.
6
7 To activate your custom menu add the following to your settings.py::
8 ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
9 """
10
11 from django.core.urlresolvers import reverse
12 from django.utils.translation import ugettext_lazy as _
13
14 from admin_tools.menu import items, Menu
15
16 from project.decorators import in_drh_or_admin
17
18
19 class CustomMenu(Menu):
20 """
21 Custom Menu for project admin site.
22 """
23
24 def __init__(self, **kwargs):
25 Menu.__init__(self, **kwargs)
26 self.children += [
27 items.MenuItem(_('Dashboard'), reverse('admin:index')),
28 #items.Bookmarks(),
29 #items.AppList(
30 # _('Applications'),
31 # exclude=('django.contrib.*', 'project.rh.models.EmployeProxy')
32 #),
33 items.AppList(
34 _('Administration'),
35 models=('django.contrib.*',))]
36
37 def init_with_context(self, context):
38 """
39 Use this method if you need to access the request context.
40 """
41 request = context['request']
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
49 if in_drh_or_admin(request.user):
50 self.children += [
51 items.MenuItem('Rapports',
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 items.MenuItem('Rapport des modifications',
75 reverse('rhr_historique_des_modifications')),
76 ]),
77
78 items.MenuItem('Organigrammes',
79 children=[
80 items.MenuItem('Organigramme par employé',
81 reverse('admin:rh_employeproxy_changelist')),
82 items.MenuItem('Organigramme par service',
83 reverse('admin:rh_serviceproxy_changelist')),
84 items.MenuItem('Organigramme par implantation',
85 reverse('admin:rh_implantationproxy_changelist')),
86 items.MenuItem('Organigramme par bureau',
87 reverse('admin:rh_regionproxy_changelist')),
88 ]),
89 items.MenuItem('Requêtes',
90 children=[
91 items.MenuItem('Requêtes sauvegardées',
92 reverse('admin:django_qbe_savedquery_changelist')),
93 items.MenuItem('Constructeur de requêtes',
94 reverse('qbe_form')),
95 ]),
96 ]
97 super(CustomMenu, self).init_with_context(context)