<td>{{ dc.implantation }}</td>
<td>{{ dc.personne }}</td>
<td>{{ dc.poste }}</td>
- <td>{{ dc.montant|floatformat:0 }} {{ dc.devise }}</td>
+ <td>{{ dc.montant|floatformat:0 }} {{ dc.devise.code }}</td>
<td>{{ dc.montant_euros|floatformat:0 }} EUR</td>
</tr>
{% endfor %}
abstract = True
def taux_devise(self):
+ if self.devise is None:
+ return None
if self.devise.code == "EUR":
return 1
annee = self.poste.date_debut.year
return list(taux)[0]
def montant_euros(self):
- return round(float(self.montant) * float(self.taux_devise()), 2)
+ taux = self.taux_devise()
+ if not taux:
+ return None
+ return round(float(self.montant) * float(taux), 2)
def __unicode__(self):
return self.nom
abstract = True
def taux_devise(self):
+ if self.devise is None:
+ return None
annee = self.dossier.contrat_date_debut.year
taux = [tc.taux for tc in TauxChange.objects.filter(devise=self.devise, annee=annee)]
taux = set(taux)
return list(taux)[0]
def montant_euros(self):
- return round(float(self.montant) * float(self.taux_devise()), 2)
+ taux = self.taux_devise()
+ if not taux:
+ return None
+ return round(float(self.montant) * float(taux), 2)
class DossierComparaison(DossierComparaison_):
pass