1 # -*- encoding: utf-8 -*-
3 from django
import template
4 from project
.dae
.workflow
import ETATS_EDITABLE
5 from project
.dae
.workflow
import grp_correspondants_rh
, grp_administrateurs
, grp_drh
7 register
= template
.Library()
10 def test_membre_drh(user
):
11 return grp_drh
in user
.groups
.all()
14 def peut_ajouter(user
):
15 for g
in user
.groups
.all():
16 if g
in (grp_administrateurs
, grp_correspondants_rh
, grp_drh
):
21 def est_editable(obj
, user
):
23 groupes_users
= user
.groups
.all()
24 if (obj
.etat
in ETATS_EDITABLE
and obj
in klass
.objects
.mes_choses_a_faire(user
).all()) or grp_drh
in groupes_users
:
30 def region_ou_service(implantation
):
31 if implantation
.id == 15:
32 return u
"Services centraux de Montréal (SCM)"
33 if implantation
.id == 19:
34 return u
"Services centraux de Paris (SCP)"
35 return implantation
.region