X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=blobdiff_plain;f=project%2Frh%2Fmodels.py;h=34d28194e7370eac9f5162a537781f5d72a7a602;hp=4156a817cb98da5c9dff6f441c9873f5911cd3c5;hb=6e0bbb73187f8eb1fc268525c264339531210814;hpb=7bd32fb15dbd65d7abd59da05598629dce7023fa;ds=sidebyside diff --git a/project/rh/models.py b/project/rh/models.py index 4156a81..34d2819 100644 --- a/project/rh/models.py +++ b/project/rh/models.py @@ -775,7 +775,19 @@ class ValeurPoint(Metadata): class Meta: ordering = ['annee', 'implantation__nom'] - + + def get_tauxchange_courant(self): + """ + Recherche le taux courant associé à la valeur d'un point. + Tous les taux de l'année courante sont chargés, pour optimiser un + affichage en liste. (On pourrait probablement améliorer le manager pour + lui greffer le taux courant sous forme de JOIN) + """ + for tauxchange in self.tauxchange: + if tauxchange.implantation_id == self.implantation_id: + return tauxchange + return None + def __unicode__(self): tx = self.get_tauxchange_courant() if tx: