[#3302] lien poste sur organig + reorg perm reg
[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
82c5e37d
DB
17from project import groups
18
6f38ca31
PP
19
20class CustomMenu(Menu):
21 """
22 Custom Menu for project admin site.
23 """
24 def __init__(self, **kwargs):
25 Menu.__init__(self, **kwargs)
26 self.children += [
27 items.MenuItem(_('Dashboard'), reverse('admin:index')),
d53e80f7 28 #items.Bookmarks(),
6f38ca31
PP
29 items.AppList(
30 _('Applications'),
f187a10f 31 exclude=('django.contrib.*', 'project.rh.models.EmployeProxy')
6f38ca31 32 ),
6f38ca31
PP
33 items.AppList(
34 _('Administration'),
35 models=('django.contrib.*',)
36 )
37 ]
38
39 def init_with_context(self, context):
40 """
41 Use this method if you need to access the request context.
42 """
595ad88d 43 request = context['request']
f96ec25c
OL
44 user_groups = request.user.groups.all()
45 if in_drh_or_admin(request.user) or\
46 groups.grp_correspondants_rh in user_groups or\
47 groups.grp_administrateurs in user_groups or\
48 groups.grp_directeurs_bureau in user_groups:
595ad88d
OL
49 self.children += [
50 items.MenuItem('Rapports',
51 children=[
aed17d86 52 #items.MenuItem('Rapport des postes', reverse('rhr_postes')),
595ad88d 53 items.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
c8b22fd1 54 items.MenuItem(u'Rapport des employés sans contrat', reverse('rhr_employe_sans_contrat')),
aed17d86 55 #items.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')),
fdfa21cc
OL
56
57 # A corriger
58 #items.MenuItem('Rapport des postes par service', reverse('rhr_postes_service')),
59 #items.MenuItem('Rapport des postes par implantation', reverse('rhr_postes_implantation')),
60
9c53414b 61 #items.MenuItem('Modelisation des postes', reverse('rhr_postes_modelisation')),
48487f09 62 #items.MenuItem('Rapport hiérarchique des postes', reverse('rhr_postes_hierarchie')),
d5f16ecd 63 items.MenuItem('Rapport de masse salariale', reverse('rhr_masse_salariale')),
595ad88d
OL
64 ]
65 ),
08faf06e
JPC
66 items.MenuItem('Organigrammes',
67 children=[
5c0f1778
JPC
68 items.MenuItem('Organigramme par employé', reverse('admin:rh_employeproxy_changelist')),
69 items.MenuItem('Organigramme par service', reverse('admin:rh_serviceproxy_changelist')),
82af5c19 70 items.MenuItem('Organigramme par implantation', reverse('admin:rh_implantationproxy_changelist')),
9da4c195 71 items.MenuItem('Organigramme par bureau', reverse('admin:rh_regionproxy_changelist')),
08faf06e
JPC
72 ]
73 ),
337c42e0
PP
74 items.MenuItem('Requêtes',
75 children=[
76 items.MenuItem('Requêtes sauvegardées', reverse('admin:django_qbe_savedquery_changelist')),
77 items.MenuItem('Constructeur de requêtes', reverse('qbe_form')),
78 ]
79 ),
595ad88d
OL
80 ]
81 super(CustomMenu, self).init_with_context(context)
82