return (float)(self.salaire_min + self.indemn_min + self.autre_min)
def get_taux_minimum(self):
- try:
- return rh.TauxChange.objects.filter(implantation=self.implantation, devise=self.devise_min)[0].taux
- except:
+ taux_changes = rh.TauxChange.objects.filter(devise=self.devise_min).order_by('annee')
+ for t in taux_changes:
+ if t.implantation == self.implantation:
+ return t.taux
+ if len(taux_changes) > 0:
+ return taux_changes[0].taux
+ else:
raise Exception('Taux indisponible pour la devise %s (%s)' % (self.devise_min, self.implantation))
def get_couts_minimum_euros(self):
return (float)(self.salaire_max + self.indemn_max + self.autre_max)
def get_taux_maximum(self):
- try:
- return rh.TauxChange.objects.filter(implantation=self.implantation, devise=self.devise_max)[0].taux
- except:
+ taux_changes = rh.TauxChange.objects.filter(devise=self.devise_max).order_by('annee')
+ for t in taux_changes:
+ if t.implantation == self.implantation:
+ return t.taux
+ if len(taux_changes) > 0:
+ return taux_changes[0].taux
+ else:
raise Exception('Taux indisponible pour la devise %s (%s)' % (self.devise_max, self.implantation))
def get_couts_maximum_euros(self):