'statut', 'organisme_bstg'
) \
.extra(
- tables=['rh_valeurpoint', 'rh_devise'],
- where=[
- 'rh_valeurpoint.annee = %s',
- 'rh_valeurpoint.implantation = ref_implantation.id',
- 'rh_devise.id = rh_valeurpoint.devise'
- ],
- params=[annee],
select={
- 'valeur_point': 'rh_valeurpoint.valeur',
- 'valeur_point_devise': 'rh_devise.code'
+ 'valeur_point': (
+ 'SELECT valeur FROM rh_valeurpoint '
+ 'WHERE annee = %d '
+ 'AND implantation = ref_implantation.id' % annee
+ ),
+ 'valeur_point_devise': (
+ 'SELECT d.code '
+ 'FROM rh_valeurpoint vp '
+ 'INNER JOIN rh_devise d ON d.id = vp.devise '
+ 'WHERE annee = %d '
+ 'AND implantation = ref_implantation.id' % annee
+ )
}
)
if region:
'taux_change': 'rh_tauxchange.taux'
}
)
+ if region:
+ remuns = remuns.filter(dossier__poste__implantation__region=region)
+ if implantation:
+ remuns = remuns.filter(dossier__poste__implantation=implantation)
remuns_par_dossier = defaultdict(list)
+ types_remun = set()
for remun in remuns:
+ types_remun.add(remun.type_id)
remuns_par_dossier[remun.dossier_id].append(remun)
# Récupérer les types de rémunération par nature
types_remun_par_nature = defaultdict(list)
for type in rh.TypeRemuneration.objects.all():
- types_remun_par_nature[type.nature_remuneration].append(type)
+ if type.id in types_remun:
+ types_remun_par_nature[type.nature_remuneration].append(type)
titres_traitements = [
t.nom for t in types_remun_par_nature[u'Traitement']
]