[#3302] lien poste sur organig + reorg perm reg
[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 from project import groups
18
19
20 class 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')),
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 ]
38
39 def init_with_context(self, context):
40 """
41 Use this method if you need to access the request context.
42 """
43 request = context['request']
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:
49 self.children += [
50 items.MenuItem('Rapports',
51 children=[
52 #items.MenuItem('Rapport des postes', reverse('rhr_postes')),
53 items.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
54 items.MenuItem(u'Rapport des employés sans contrat', reverse('rhr_employe_sans_contrat')),
55 #items.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')),
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
61 #items.MenuItem('Modelisation des postes', reverse('rhr_postes_modelisation')),
62 #items.MenuItem('Rapport hiérarchique des postes', reverse('rhr_postes_hierarchie')),
63 items.MenuItem('Rapport de masse salariale', reverse('rhr_masse_salariale')),
64 ]
65 ),
66 items.MenuItem('Organigrammes',
67 children=[
68 items.MenuItem('Organigramme par employé', reverse('admin:rh_employeproxy_changelist')),
69 items.MenuItem('Organigramme par service', reverse('admin:rh_serviceproxy_changelist')),
70 items.MenuItem('Organigramme par implantation', reverse('admin:rh_implantationproxy_changelist')),
71 items.MenuItem('Organigramme par bureau', reverse('admin:rh_regionproxy_changelist')),
72 ]
73 ),
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 ),
80 ]
81 super(CustomMenu, self).init_with_context(context)
82