From 6e0bbb73187f8eb1fc268525c264339531210814 Mon Sep 17 00:00:00 2001 From: Nicolas Cadou Date: Fri, 13 May 2011 22:08:06 -0400 Subject: [PATCH] =?utf8?q?corrig=C3=A9=20un=20bug=20d=C3=BB=20=C3=A0=20une=20?= =?utf8?q?fonction=20manquante?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/rh/models.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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: -- 1.7.10.4