Gestion du mode arbitraire inadéquate
This commit is contained in:
parent
e16ff77675
commit
f52422622a
1 changed files with 4 additions and 3 deletions
|
@ -411,7 +411,7 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
"cheque" : "Chèque",
|
"cheque" : "Chèque",
|
||||||
"carte" : "Par carte bancaire",
|
"carte" : "Par carte bancaire",
|
||||||
"solde" : "Solde Crans (actuel : %s€)",
|
"solde" : "Solde Crans (actuel : %s€)",
|
||||||
"arbitraire" : "Ne crée pas de facture",
|
"arbitraire" : "Création ou destruction magique d'argent.",
|
||||||
}
|
}
|
||||||
|
|
||||||
def box_choose_paiment(tag, articles):
|
def box_choose_paiment(tag, articles):
|
||||||
|
@ -420,8 +420,9 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
if not "SOLDE" in [art['code'] for art in articles] and proprio["solde"]:
|
if not "SOLDE" in [art['code'] for art in articles] and proprio["solde"]:
|
||||||
box_paiement_order.append("solde")
|
box_paiement_order.append("solde")
|
||||||
box_paiement["solde"] = box_paiement["solde"] % proprio["solde"][0]
|
box_paiement["solde"] = box_paiement["solde"] % proprio["solde"][0]
|
||||||
else:
|
if len(articles) == 1 and "SOLDE" in [art['code'] for art in articles]:
|
||||||
box_paiement_order.append("arbitraire")
|
box_paiement_order.append("arbitraire")
|
||||||
|
|
||||||
choices = []
|
choices = []
|
||||||
for key in box_paiement_order:
|
for key in box_paiement_order:
|
||||||
choices.append((key, box_paiement[key], 1 if key == tag else 0))
|
choices.append((key, box_paiement[key], 1 if key == tag else 0))
|
||||||
|
@ -512,7 +513,7 @@ class Dialog(machine.Dialog, blacklist.Dialog):
|
||||||
|
|
||||||
# En arbitraire, on accepte que le solde
|
# En arbitraire, on accepte que le solde
|
||||||
if tag == u"arbitraire":
|
if tag == u"arbitraire":
|
||||||
if len(articles) > 1:
|
if len(articles) > 1 or "SOLDE" not in [art['code'] for art in articles]:
|
||||||
raise ValueError("Il n'est possible que de faire une opération de solde en mode arbitraire")
|
raise ValueError("Il n'est possible que de faire une opération de solde en mode arbitraire")
|
||||||
else:
|
else:
|
||||||
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as adh:
|
with self.conn.search(dn=proprio.dn, scope=0, mode='rw')[0] as adh:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue