POSTE_ETAT_AFB, \
POSTE_ETAT_REFUSE, \
DOSSIER_ETAT_REFUSE, \
+ DOSSIER_ETAT_ACCIOR, \
+ DOSSIER_ETAT_AFB, \
MAP_GROUPE_ETATS_A_FAIRE
from workflow import dae_groupes, \
grp_administrateurs, \
############################################
# TRAITEMENT NORMAL
############################################
+ # REGION
+ q = Q(**{ self.prefixe_implantation : employe.implantation.region })
+
# SERVICE
if workflowed_model and grp_service_utilisateurs in user.groups.all():
- q = Q(**{ self.prefixe_service : employe.service})
- # REGION
- else:
- q = Q(**{ self.prefixe_implantation : employe.implantation.region })
+ q = q | Q(**{ self.prefixe_service : employe.service})
if workflowed_model:
q_non_refuse = ~Q(etat__in=(POSTE_ETAT_REFUSE, DOSSIER_ETAT_REFUSE,))
# TRAITEMENT ACCIOR
############################################
if workflowed_model and grp_accior in user.groups.all():
- liste = self.get_query_set().filter(q_non_refuse)
+ liste = liste | self.get_query_set().filter(q_non_refuse & Q(etat__in=(POSTE_ETAT_ACCIOR, DOSSIER_ETAT_ACCIOR,)))
############################################
# TRAITEMENT AFB
def acces_refuse(self, action, request):
user_groupes = request.user.groups.all()
- if grp_accior in user_groupes or grp_afb in user_groupes:
+ if (grp_accior in user_groupes or grp_afb in user_groupes) and len(user_groupes) == 1:
return False
+ return True
user_groupes = request.user.groups.all()
for g, etats in MAP_GROUPE_ETATS_A_FAIRE.items():