qbe pour DRH ou admin
authorOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 20 Sep 2012 15:16:26 +0000 (11:16 -0400)
committerOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 20 Sep 2012 15:16:26 +0000 (11:16 -0400)
project/menu.py

index 03e4c1a..ff84e67 100644 (file)
@@ -66,11 +66,8 @@ class CustomMenu(Menu):
                         items.MenuItem('Rapport des modifications',
                             reverse('rhr_historique_des_modifications')),
                         )
-            self.children += [
-                items.MenuItem('Rapports',
-                    children=rapports),
 
-                items.MenuItem('Organigrammes',
+            items_organigrammes = items.MenuItem('Organigrammes',
                     children=[
                         items.MenuItem('Organigramme par employé',
                             reverse('admin:rh_employeproxy_changelist')),
@@ -80,13 +77,22 @@ class CustomMenu(Menu):
                             reverse('admin:rh_implantationproxy_changelist')),
                         items.MenuItem('Organigramme par bureau',
                             reverse('admin:rh_regionproxy_changelist')),
-                        ]),
-                items.MenuItem('Requêtes',
+                        ])
+
+            items_rapports = items.MenuItem('Rapports', children=rapports)
+
+            items_requetes = items.MenuItem('Requêtes',
                     children=[
                         items.MenuItem('Requêtes sauvegardées',
                             reverse('admin:django_qbe_savedquery_changelist')),
                         items.MenuItem('Constructeur de requêtes',
                             reverse('qbe_form')),
-                        ]),
-            ]
+                        ])
+
+            children = [items_rapports, items_organigrammes, ]
+            if in_drh_or_admin(request.user):
+                children.append(items_requetes)
+
+            self.children += children
+
         super(CustomMenu, self).init_with_context(context)