# Récupérer les postes actifs pour déterminer le nombre de jours
# vacants.
- postes = list(
- rh.Poste.objects.actifs(annee=annee)
- .select_related(
- 'devise_max', 'valeur_point_max', 'classement_max'
- )
- .extra(
- tables=['rh_tauxchange'],
- where=[
- 'rh_tauxchange.annee = %s',
- 'rh_tauxchange.devise = rh_devise.id'
- ],
- params=[annee],
- select={
- 'taux_change': 'rh_tauxchange.taux'
- }
- )
- )
+ postes = rh.Poste.objects.actifs(annee=annee) \
+ .select_related(
+ 'devise_max', 'valeur_point_max', 'classement_max'
+ ) \
+ .extra(
+ tables=['rh_tauxchange'],
+ where=[
+ 'rh_tauxchange.annee = %s',
+ 'rh_tauxchange.devise = rh_devise.id'
+ ],
+ params=[annee],
+ select={
+ 'taux_change': 'rh_tauxchange.taux'
+ }
+ )
+ if region:
+ postes = postes.filter(implantation__region=region)
+ if implantation:
+ postes = postes.filter(implantation=implantation)
+ postes = list(postes)
postes_par_id = dict((poste.id, poste) for poste in postes)
jours_vacants_date = dict(
(poste.id, max(today, poste.date_debut or today))