cacher le lien de rapport modif
[auf_rh_dae.git] / project / menu.py
index 4ec08dd..03e4c1a 100644 (file)
@@ -48,38 +48,27 @@ class CustomMenu(Menu):
                         kwargs={'app_label': 'dae'})),
                     ]
 
-        user_groups = request.user.groups.all()
+        user_groups = [g.name for g in request.user.groups.all()]
         if in_drh_or_admin(request.user) or\
-           groups.grp_correspondants_rh in user_groups or\
-           groups.grp_administrateurs in user_groups or\
-           groups.grp_directeurs_bureau in user_groups:
-            self.children += [
-                items.MenuItem('Rapports',
-                    children=[
-                        #items.MenuItem('Rapport des postes',
-                        #     reverse('rhr_postes')),
+           groups.CORRESPONDANT_RH in user_groups or\
+           groups.ADMINISTRATEURS in user_groups or\
+           groups.DIRECTEUR_DE_BUREAU in user_groups:
+            rapports = [
                         items.MenuItem('Rapport des contrats',
                             reverse('rhr_contrats')),
                         items.MenuItem(u'Rapport des employés sans contrat',
                             reverse('rhr_employe_sans_contrat')),
-                        #items.MenuItem('Rapport de rémunération',
-                        #     reverse('rhr_remuneration')),
-
-                        # A corriger
-                        #items.MenuItem('Rapport des postes par service',
-                        #    reverse('rhr_postes_service')),
-                        #items.MenuItem('Rapport des postes par implantation',
-                        #     reverse('rhr_postes_implantation')),
-
-                        #items.MenuItem('Modelisation des postes',
-                        #     reverse('rhr_postes_modelisation')),
-                        #items.MenuItem('Rapport hiérarchique des postes',
-                        #     reverse('rhr_postes_hierarchie')),
                         items.MenuItem('Rapport de masse salariale',
                             reverse('rhr_masse_salariale')),
+                    ]
+            if in_drh_or_admin(request.user):
+                rapports.append(
                         items.MenuItem('Rapport des modifications',
                             reverse('rhr_historique_des_modifications')),
-                        ]),
+                        )
+            self.children += [
+                items.MenuItem('Rapports',
+                    children=rapports),
 
                 items.MenuItem('Organigrammes',
                     children=[