b56f4851e7c0c5b56fde49ee24cbc2fb86956b65
[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 from project.rh.decorators import in_drh_or_admin
16
17 class CustomMenu(Menu):
18 """
19 Custom Menu for project admin site.
20 """
21 def __init__(self, **kwargs):
22 Menu.__init__(self, **kwargs)
23 self.children += [
24 items.MenuItem(_('Dashboard'), reverse('admin:index')),
25 #items.Bookmarks(),
26 items.AppList(
27 _('Applications'),
28 exclude=('django.contrib.*', 'project.rh.models.EmployeProxy')
29 ),
30 items.AppList(
31 _('Administration'),
32 models=('django.contrib.*',)
33 )
34 ]
35
36 def init_with_context(self, context):
37 """
38 Use this method if you need to access the request context.
39 """
40 request = context['request']
41 if in_drh_or_admin(request.user):
42 self.children += [
43 items.MenuItem('Rapports',
44 children=[
45 #items.MenuItem('Rapport des postes', reverse('rhr_postes')),
46 items.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
47 items.MenuItem(u'Rapport des employés sans contrat', reverse('rhr_employe_sans_contrat')),
48 #items.MenuItem('Rapport de rémunération', reverse('rhr_remuneration')),
49 items.MenuItem('Rapport des postes par service', reverse('rhr_postes_service')),
50 items.MenuItem('Rapport des postes par implantation', reverse('rhr_postes_implantation')),
51 #items.MenuItem('Modelisation des postes', reverse('rhr_postes_modelisation')),
52 #items.MenuItem('Rapport hiérarchique des postes', reverse('rhr_postes_hierarchie')),
53 items.MenuItem('Rapport de masse salariale', reverse('rhr_masse_salariale')),
54 ]
55 ),
56 items.MenuItem('Organigrammes',
57 children=[
58 items.MenuItem('Organigramme par employé', reverse('admin:rh_employeproxy_changelist')),
59 items.MenuItem('Organigramme par service', reverse('admin:rh_serviceproxy_changelist')),
60 items.MenuItem('Organigramme par implantation', reverse('admin:rh_implantationproxy_changelist')),
61 items.MenuItem('Organigramme par bureau', reverse('admin:rh_regionproxy_changelist')),
62 ]
63 ),
64 ]
65 super(CustomMenu, self).init_with_context(context)
66