impression_canon: calcule le prix à la fin

C'est un calcul en plus, pour être sûr de facturer le bon prix. Enfin, la race
condition pourrait toujours arriver.
This commit is contained in:
Daniel STAN 2014-01-12 23:28:47 +01:00
parent f657e57a0d
commit cb9dda8c7a

View file

@ -390,6 +390,7 @@ class impression:
if len(adh) > 1: if len(adh) > 1:
adh = adh[1:] adh = adh[1:]
adh = self._get_adh(adh[0]) adh = self._get_adh(adh[0])
self._calcule_prix() # Normalement inutile, mais évite les races
if (self._prix > (adh.solde() - DECOUVERT_AUTHORISE)): if (self._prix > (adh.solde() - DECOUVERT_AUTHORISE)):
raise SoldeInsuffisant raise SoldeInsuffisant
adh.solde(-self._prix, "impression(%d): %s par %s" % (self._jid,self._fichier,self._adh)) adh.solde(-self._prix, "impression(%d): %s par %s" % (self._jid,self._fichier,self._adh))