[factures] GROS HACK pour rester comptatible avec ldap_crans où l'article representant les frais n'est ajouté qu'une fois le paiement reçu
This commit is contained in:
parent
82f70678ea
commit
0c157efaae
1 changed files with 24 additions and 0 deletions
24
objets.py
24
objets.py
|
@ -962,6 +962,30 @@ class facture(CransLdapObject):
|
||||||
|
|
||||||
_proprio = None
|
_proprio = None
|
||||||
|
|
||||||
|
#### GROS HACK pour rester comptatible avec ldap_crans où l'article representant les frais n'est ajouté qu'une fois le paiement reçu
|
||||||
|
def __init__(self, conn, dn, mode='ro', ldif=None):
|
||||||
|
super(facture, self).__init__(conn, dn, mode, ldif)
|
||||||
|
self._frais = []
|
||||||
|
if not self.get('recuPaiement', []):
|
||||||
|
if str(self['modePaiement'][0]) == 'paypal':
|
||||||
|
# 25 centimes pour le paiement paypal
|
||||||
|
s = 0.25
|
||||||
|
# et on ajoute 3.5% du montant
|
||||||
|
for art in self['article']:
|
||||||
|
s += 0.035 * int(art['nombre']) * float(art['pu'])
|
||||||
|
# arrondissage-tronquage
|
||||||
|
s = float(int(s*100)/100.0)
|
||||||
|
# ajoute à la liste d'articles de frais
|
||||||
|
self._frais.append(attributs.attrify('FRAIS~~Frais de tansaction PayPal~~1~~%s' % round(s, 2), 'article', self.conn, Parent=self))
|
||||||
|
|
||||||
|
def __getitem__(self,attr):
|
||||||
|
ret = super(facture, self).__getitem__(attr)
|
||||||
|
if attr == 'article' and self.mode == 'ro':
|
||||||
|
return ret + self._frais
|
||||||
|
else:
|
||||||
|
return ret
|
||||||
|
#### FIN DU GROS HACK
|
||||||
|
|
||||||
def proprio(self):
|
def proprio(self):
|
||||||
u"""Renvoie le propriétaire de la facture"""
|
u"""Renvoie le propriétaire de la facture"""
|
||||||
parent_dn = self.dn.split(',', 1)[1]
|
parent_dn = self.dn.split(',', 1)[1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue