employe = get_employe_from_user(request.user)
lookup_params['poste__implantation__region'] = employe.implantation.region
-
dossiers = rh.Dossier.objects.sans_contrats_ou_echus(**lookup_params)
dossiers_ids = [d.id for d in dossiers]
employes = rh.Employe.objects.filter(id__in=dossiers_ids).distinct().count()
remuns = remun_actives.extra(
tables=['rh_tauxchange'],
where=[
- 'rh_tauxchange.annee = %s',
- 'rh_tauxchange.devise = rh_devise.id'
+ 'rh_tauxchange.devise = rh_devise.id',
+ 'rh_tauxchange.annee = '
+ '(SELECT MAX(annee) FROM rh_tauxchange '
+ 'WHERE devise = rh_devise.id '
+ 'AND annee <= %s)',
],
params=[annee],
select={