La modification du solde crée une facture, et on enlève solde de vente.
This commit is contained in:
parent
a6c38a88bf
commit
7b56a15685
3 changed files with 139 additions and 101 deletions
|
@ -20,11 +20,6 @@ ITEMS = {
|
||||||
'designation': u'Reliure plastique',
|
'designation': u'Reliure plastique',
|
||||||
'pu': 0.12,
|
'pu': 0.12,
|
||||||
},
|
},
|
||||||
'SOLDE': {
|
|
||||||
'designation': u'Rechargement du solde',
|
|
||||||
'pu': '*',
|
|
||||||
'imprimeur': True,
|
|
||||||
},
|
|
||||||
'PULL_ZIP_MARK': {
|
'PULL_ZIP_MARK': {
|
||||||
'designation': u'Zipper marqué',
|
'designation': u'Zipper marqué',
|
||||||
'pu': 39.18,
|
'pu': 39.18,
|
||||||
|
|
|
@ -24,7 +24,7 @@ To = ['root@crans.org']
|
||||||
import string
|
import string
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import dialog
|
import dialog as dialog_module
|
||||||
from whos import aff
|
from whos import aff
|
||||||
import signal
|
import signal
|
||||||
import getopt
|
import getopt
|
||||||
|
@ -62,13 +62,13 @@ if u'Nounou' in droits:
|
||||||
# Sinon on utilise celui du système.
|
# Sinon on utilise celui du système.
|
||||||
DIALOGRC = '/etc/dialog.rc'
|
DIALOGRC = '/etc/dialog.rc'
|
||||||
|
|
||||||
dlg = dialog.Dialog(DIALOGRC=DIALOGRC)
|
dlg = dialog_module.Dialog(DIALOGRC=DIALOGRC)
|
||||||
else:
|
else:
|
||||||
# Si on est pas nounou, on est libre de faire ce que l'on veut avec la
|
# Si on est pas nounou, on est libre de faire ce que l'on veut avec la
|
||||||
# variable d'environnement DIALOGRC.
|
# variable d'environnement DIALOGRC.
|
||||||
DIALOGRC = ''
|
DIALOGRC = ''
|
||||||
|
|
||||||
dlg = dialog.Dialog()
|
dlg = dialog_module.Dialog()
|
||||||
|
|
||||||
|
|
||||||
def dialog(arg):
|
def dialog(arg):
|
||||||
|
@ -264,7 +264,7 @@ def set_etudes(adher):
|
||||||
arg += u'"Autre" ""'
|
arg += u'"Autre" ""'
|
||||||
annul, result = dialog(arg)
|
annul, result = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
elif etudes[0] in [ 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9', 'P10', 'P11', 'P12', 'P13' ]:
|
elif etudes[0] in ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9', 'P10', 'P11', 'P12', 'P13']:
|
||||||
arg += u'--default-item "%s" ' % adher.etudes(1)
|
arg += u'--default-item "%s" ' % adher.etudes(1)
|
||||||
arg += u'--menu "Choisissez l\'année administrative" 0 0 0 '
|
arg += u'--menu "Choisissez l\'année administrative" 0 0 0 '
|
||||||
arg += u'"Deug 1" "Deug 1ère année" '
|
arg += u'"Deug 1" "Deug 1ère année" '
|
||||||
|
@ -664,9 +664,11 @@ def set_droits(adher):
|
||||||
# Droits supprimés qui abonnaient à une ML
|
# Droits supprimés qui abonnaient à une ML
|
||||||
old_mls = []
|
old_mls = []
|
||||||
for droit in diff:
|
for droit in diff:
|
||||||
old_mls.extend([m for m in droits_mls.keys()
|
old_mls.extend([
|
||||||
|
m for m in droits_mls.keys()
|
||||||
if m[0] == '+' and droit in droits_mls[m]
|
if m[0] == '+' and droit in droits_mls[m]
|
||||||
and m not in old_mls])
|
and m not in old_mls
|
||||||
|
])
|
||||||
|
|
||||||
# MLs pour lesquelles un autre droit abonne encore
|
# MLs pour lesquelles un autre droit abonne encore
|
||||||
for droit in new:
|
for droit in new:
|
||||||
|
@ -689,8 +691,10 @@ def set_droits(adher):
|
||||||
del_mls.append(resml.strip())
|
del_mls.append(resml.strip())
|
||||||
|
|
||||||
if del_mls:
|
if del_mls:
|
||||||
db.services_to_restart('desabonner_ml',
|
db.services_to_restart('desabonner_ml', [
|
||||||
map(lambda m: "%s$%s" % (adher.mail(), m), resultmls))
|
"%s$%s" % (adher.mail(), mailing_list)
|
||||||
|
for mailing_list in resultmls
|
||||||
|
])
|
||||||
|
|
||||||
# On modifie !
|
# On modifie !
|
||||||
e = None
|
e = None
|
||||||
|
@ -841,7 +845,7 @@ def set_imprimeurs(club):
|
||||||
break
|
break
|
||||||
if not choix:
|
if not choix:
|
||||||
# Redemande le choix
|
# Redemande le choix
|
||||||
cprint (u'Choix invalide')
|
cprint(u'Choix invalide')
|
||||||
continue
|
continue
|
||||||
if choix: break
|
if choix: break
|
||||||
|
|
||||||
|
@ -1011,9 +1015,35 @@ def set_solde(clas):
|
||||||
annul, res = dialog(arg)
|
annul, res = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
|
|
||||||
|
_montant = float(res[0])
|
||||||
|
|
||||||
|
menu = []
|
||||||
|
|
||||||
|
menu.append(u'"Liquide" "Espèces" ')
|
||||||
|
menu.append(u'"Cheque" "Chèque" ')
|
||||||
|
menu.append(u'"Carte" "Carte bancaire" ')
|
||||||
|
menu.append(u'"Note" "Note Kfet (attention, moins traçable)" ')
|
||||||
|
|
||||||
|
if _montant > 0:
|
||||||
|
_kword = u"Crédit"
|
||||||
|
_kword2 = u"paiement"
|
||||||
|
else:
|
||||||
|
_kword = u"Débit"
|
||||||
|
_kword2 = u"retrait"
|
||||||
|
|
||||||
|
# Il y a qqch de modifiable, on construit la checklist
|
||||||
|
arg = u'--title "%s du solde de %s" ' % (_kword, clas.Nom())
|
||||||
|
arg += u'--menu "Mode de %s : " 0 0 0 ' % (_kword2,)
|
||||||
|
arg += u''.join(menu)
|
||||||
|
|
||||||
|
annul, result = dialog(arg)
|
||||||
|
if annul: return 1
|
||||||
|
|
||||||
|
_mode = result[0]
|
||||||
|
|
||||||
# Ajout du commentaire
|
# Ajout du commentaire
|
||||||
arg = u'--title "Crédit / débit du compte de %s" ' % clas.Nom()
|
arg = u'--title "%s du solde de %s" ' % (_kword, clas.Nom())
|
||||||
arg += u'--inputbox "Commentaire à insérer ?" 0 0'
|
arg += u'--inputbox "Commentaire à insérer (nom de note, …) ?" 0 0'
|
||||||
annul, comment = dialog(arg)
|
annul, comment = dialog(arg)
|
||||||
|
|
||||||
if not annul:
|
if not annul:
|
||||||
|
@ -1022,22 +1052,27 @@ def set_solde(clas):
|
||||||
else:
|
else:
|
||||||
comment = None
|
comment = None
|
||||||
|
|
||||||
|
f = Facture(clas)
|
||||||
|
f.ajoute({'nombre': 1, 'code':'SOLDE', 'designation': "Solde Crans", 'pu': _montant})
|
||||||
|
f.modePaiement(_mode.lower())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
clas._data['uid'][0]
|
# Met aussi à jour le solde.
|
||||||
except KeyError:
|
f.recuPaiement(strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
arg = u'--title "Opération impossible" '
|
f.save()
|
||||||
arg += u'--msgbox "Il faut créer un compte Cr@ns pour modifier le solde" 0 0'
|
db.services_to_restart('mail_solde', [
|
||||||
dialog(arg)
|
'%s a fait %s euros pour %s [mode: %s, remarque: %s]' %
|
||||||
return
|
(script_utilisateur, _montant, clas._data['uid'][0], _mode, comment)
|
||||||
try:
|
])
|
||||||
clas.solde(res[0], comment)
|
|
||||||
db.services_to_restart('mail_solde', ['%s a fait %s euros pour %s [%s]' %(script_utilisateur, res[0],clas._data['uid'][0], comment)])
|
|
||||||
break
|
|
||||||
except ValueError, c:
|
except ValueError, c:
|
||||||
arg = u'--title "Opération impossible" '
|
arg = u'--title "Opération impossible" '
|
||||||
arg += u'--msgbox "%s\n\n\n" 0 0' % to_unicode(c.args[0])
|
arg += u'--msgbox "%s\n\n\n" 0 0' % to_unicode(c.args[0])
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
|
|
||||||
|
arg = u'--title "%s du solde de %s" ' % (_kword, clas.Nom())
|
||||||
|
arg += u'--msgbox "Modification effectuée, merci de noter le numéro de facture %s." 0 0' % (f.numero(),)
|
||||||
|
dialog(arg)
|
||||||
|
|
||||||
def set_vente(proprio):
|
def set_vente(proprio):
|
||||||
u"""
|
u"""
|
||||||
Vend un objet à l'adherent : génère la facture associée.
|
Vend un objet à l'adherent : génère la facture associée.
|
||||||
|
@ -1083,7 +1118,7 @@ def set_vente(proprio):
|
||||||
annul, res = dialog(arg)
|
annul, res = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
try:
|
try:
|
||||||
nombre=int(res[0])
|
nombre = int(res[0])
|
||||||
break
|
break
|
||||||
except ValueError, c:
|
except ValueError, c:
|
||||||
arg = u'--title "Opération impossible" '
|
arg = u'--title "Opération impossible" '
|
||||||
|
@ -1095,7 +1130,7 @@ def set_vente(proprio):
|
||||||
annul, res = dialog(arg)
|
annul, res = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
try:
|
try:
|
||||||
nombre=float(res[0])
|
nombre = float(res[0])
|
||||||
break
|
break
|
||||||
except ValueError, c:
|
except ValueError, c:
|
||||||
arg = u'--title "Opération impossible" '
|
arg = u'--title "Opération impossible" '
|
||||||
|
@ -1124,7 +1159,7 @@ def set_vente(proprio):
|
||||||
menu.append(u'"Spc" "Espèces" ')
|
menu.append(u'"Spc" "Espèces" ')
|
||||||
menu.append(u'"Chq" "Chèque" ')
|
menu.append(u'"Chq" "Chèque" ')
|
||||||
menu.append(u'"Cb" "Carte bancaire" ')
|
menu.append(u'"Cb" "Carte bancaire" ')
|
||||||
if isimprimeur:
|
if isimprimeur and proprio.solde() - f.total() > 0:
|
||||||
menu.append(u'"Sol" "Solde Crans (actuel : %s€)" ' % (proprio.solde()))
|
menu.append(u'"Sol" "Solde Crans (actuel : %s€)" ' % (proprio.solde()))
|
||||||
|
|
||||||
# Il y a qqch de modifiable, on construit la checklist
|
# Il y a qqch de modifiable, on construit la checklist
|
||||||
|
@ -1134,26 +1169,25 @@ def set_vente(proprio):
|
||||||
|
|
||||||
annul, result = dialog(arg)
|
annul, result = dialog(arg)
|
||||||
if annul: return 1
|
if annul: return 1
|
||||||
#print result
|
|
||||||
|
|
||||||
# Ajout du commentaire
|
# Ajout du commentaire
|
||||||
arg = u'--title "Crédit / débit du compte de %s" ' % proprio.Nom()
|
arg = u'--title "Crédit / débit du compte de %s" ' % proprio.Nom()
|
||||||
arg += u'--inputbox "Commentaire à insérer ?" 0 0'
|
arg += u'--inputbox "Commentaire à insérer ?" 0 0'
|
||||||
if result[0] == "Spc":
|
if result[0] == "Spc":
|
||||||
f.modePaiement('liquide')
|
f.modePaiement('liquide')
|
||||||
paiement=u"Espèce"
|
paiement = u"Espèce"
|
||||||
annul, comment = dialog(arg)
|
annul, comment = dialog(arg)
|
||||||
elif result[0] == "Cb":
|
elif result[0] == "Cb":
|
||||||
f.modePaiement('carte')
|
f.modePaiement('carte')
|
||||||
paiement=u"Carte Bancaire"
|
paiement = u"Carte Bancaire"
|
||||||
comment = None
|
comment = None
|
||||||
elif result[0] == "Chq":
|
elif result[0] == "Chq":
|
||||||
f.modePaiement('cheque')
|
f.modePaiement('cheque')
|
||||||
paiement=u"Chèque"
|
paiement = u"Chèque"
|
||||||
annul, comment = dialog(arg)
|
annul, comment = dialog(arg)
|
||||||
elif result[0] == "Sol" and isimprimeur:
|
elif result[0] == "Sol" and isimprimeur:
|
||||||
f.modePaiement('solde')
|
f.modePaiement('solde')
|
||||||
paiement=u"Solde Crans"
|
paiement = u"Solde Crans"
|
||||||
comment = None
|
comment = None
|
||||||
|
|
||||||
if comment and comment[0]:
|
if comment and comment[0]:
|
||||||
|
@ -1161,15 +1195,15 @@ def set_vente(proprio):
|
||||||
else:
|
else:
|
||||||
comment = None
|
comment = None
|
||||||
|
|
||||||
return (f,paiement,comment)
|
return (f, paiement, comment)
|
||||||
|
|
||||||
def confirm_and_pay((f,paiement,comment)):
|
def confirm_and_pay((f, paiement, comment)):
|
||||||
arg = u'--title "Validation du paiement" '
|
arg = u'--title "Validation du paiement" '
|
||||||
arg += u'--yesno "Le paiement de %s€ a-t-il bien été reçu (mode : %s) ?\n" 0 0 ' % (f.total(), paiement)
|
arg += u'--yesno "Le paiement de %s€ a-t-il bien été reçu (mode : %s) ?\n" 0 0 ' % (f.total(), paiement)
|
||||||
no, result = dialog(arg)
|
no, result = dialog(arg)
|
||||||
if no:
|
if no:
|
||||||
arg = u'--title "Annulation de la vente" '
|
arg = u'--title "Annulation de la vente" '
|
||||||
arg += u'--msgbox "Le paiement n\'ayant pas été reçue\nla vente est annulée\n" 0 0'
|
arg += u'--msgbox "Le paiement n\'ayant pas été reçu\nla vente est annulée\n" 0 0'
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
|
@ -1177,9 +1211,10 @@ def set_vente(proprio):
|
||||||
f.recuPaiement(strftime("%Y-%m-%d %H:%M:%S"))
|
f.recuPaiement(strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
f.save()
|
f.save()
|
||||||
arg = u'--title "Vente terminée" '
|
arg = u'--title "Vente terminée" '
|
||||||
arg += u'--msgbox "Vous pouvez remettre à l\'adherent les articles suivant :\n%s\n\nMerci de noter la facture: fid=%s" 0 0' % ('\n'.join(
|
arg += u'--msgbox "Vous pouvez remettre à l\'adherent les articles suivant :\n%s\n\nMerci de noter la facture: fid=%s" 0 0' % ('\n'.join([
|
||||||
["%s %s" % (art['nombre'], art['designation']) for art in f.articles()]),
|
"%s %s" % (art['nombre'], art['designation'])
|
||||||
f.numero())
|
for art in f.articles()
|
||||||
|
]), f.numero())
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
f.delete()
|
f.delete()
|
||||||
|
@ -1470,15 +1505,15 @@ def set_adhesion(proprio):
|
||||||
facture._set('debutAdhesion', [])
|
facture._set('debutAdhesion', [])
|
||||||
facture.supprime(pop=True)
|
facture.supprime(pop=True)
|
||||||
return 1
|
return 1
|
||||||
res = res[0]
|
_mode = res[0]
|
||||||
if res in ["Liquide", "Cheque", "Carte"]:
|
if _mode in ["Liquide", "Cheque", "Carte"]:
|
||||||
arg = u'--title "Avertissement" '
|
arg = u'--title "Avertissement" '
|
||||||
arg += u'--msgbox "Une facture sera créée, après validation par le trésorier, l\'adhérent\npourra y accéder via l\'intranet ou la demander." 0 0'
|
arg += u'--msgbox "Une facture sera créée, après validation par le trésorier, l\'adhérent\npourra y accéder via l\'intranet ou la demander." 0 0'
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
facture.modePaiement(res.lower())
|
facture.modePaiement(_mode.lower())
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
facture.modePaiement(res.lower())
|
facture.modePaiement(_mode.lower())
|
||||||
break
|
break
|
||||||
in_facture = facture
|
in_facture = facture
|
||||||
|
|
||||||
|
@ -1591,15 +1626,15 @@ def set_connexion(proprio):
|
||||||
facture._set('debutConnexion', [])
|
facture._set('debutConnexion', [])
|
||||||
facture.supprime(pop=True)
|
facture.supprime(pop=True)
|
||||||
continue
|
continue
|
||||||
res = res[0]
|
_mode = res[0]
|
||||||
if res in ["Liquide", "Cheque", "Carte"]:
|
if _mode in ["Liquide", "Cheque", "Carte"]:
|
||||||
arg = u'--title "Avertissement" '
|
arg = u'--title "Avertissement" '
|
||||||
arg += u'--msgbox "Une facture sera créée, après validation par le trésorier, l\'adhérent\npourra y accéder via l\'intranet ou la demander." 0 0'
|
arg += u'--msgbox "Une facture sera créée, après validation par le trésorier, l\'adhérent\npourra y accéder via l\'intranet ou la demander." 0 0'
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
facture.modePaiement(res.lower())
|
facture.modePaiement(_mode.lower())
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
facture.modePaiement(res.lower())
|
facture.modePaiement(_mode.lower())
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
@ -1662,7 +1697,7 @@ def modif_club(club):
|
||||||
arg += u'"Alias" "Créer ou supprimer un alias mail" '
|
arg += u'"Alias" "Créer ou supprimer un alias mail" '
|
||||||
if isdeconnecteur:
|
if isdeconnecteur:
|
||||||
arg += u'"Blackliste" "Modifier la blackliste du club" '
|
arg += u'"Blackliste" "Modifier la blackliste du club" '
|
||||||
if isimprimeur:
|
if isimprimeur and club.compte():
|
||||||
arg += u'"Solde" "Effectuer un débit/crédit pour ce club" '
|
arg += u'"Solde" "Effectuer un débit/crédit pour ce club" '
|
||||||
arg += u'"Vente" "Vendre un cable ou adaptateur ethernet ou autre" '
|
arg += u'"Vente" "Vendre un cable ou adaptateur ethernet ou autre" '
|
||||||
|
|
||||||
|
@ -1845,7 +1880,7 @@ def set_wifi(machine):
|
||||||
if result[2].strip().lower() == "none" or result[3].strip().lower() == "none":
|
if result[2].strip().lower() == "none" or result[3].strip().lower() == "none":
|
||||||
machine.position(None)
|
machine.position(None)
|
||||||
else:
|
else:
|
||||||
machine.position((result[2].strip(),result[3].strip()))
|
machine.position((result[2].strip(), result[3].strip()))
|
||||||
except ValueError, c: err += c.args[0] + '\n'
|
except ValueError, c: err += c.args[0] + '\n'
|
||||||
|
|
||||||
if result[4].lower().strip() == "oui":
|
if result[4].lower().strip() == "oui":
|
||||||
|
@ -1866,7 +1901,7 @@ def set_wifi(machine):
|
||||||
variable = nvram.split('=')[0].strip()
|
variable = nvram.split('=')[0].strip()
|
||||||
valeur = nvram.split('=')[1].strip()
|
valeur = nvram.split('=')[1].strip()
|
||||||
if valeur.lower() == "none":
|
if valeur.lower() == "none":
|
||||||
valeur=None
|
valeur = None
|
||||||
machine.nvram(variable, valeur)
|
machine.nvram(variable, valeur)
|
||||||
except ValueError, c: err += c.args[0] + '\n'
|
except ValueError, c: err += c.args[0] + '\n'
|
||||||
# Des erreurs ?
|
# Des erreurs ?
|
||||||
|
@ -1931,7 +1966,7 @@ def set_machine(machine):
|
||||||
err += c.args[0] + '\n'
|
err += c.args[0] + '\n'
|
||||||
try: machine.ip(result[2])
|
try: machine.ip(result[2])
|
||||||
except ValueError, c:
|
except ValueError, c:
|
||||||
if len(c.args)>1 and c.args[1] == 1 and isadm:
|
if len(c.args) > 1 and c.args[1] == 1 and isadm:
|
||||||
arg = u'--title "Plage d\'ip" '
|
arg = u'--title "Plage d\'ip" '
|
||||||
arg += u'--yesno "La machine va être ajoutée en v6 only, continuer ? \n" 0 0'
|
arg += u'--yesno "La machine va être ajoutée en v6 only, continuer ? \n" 0 0'
|
||||||
no, res = dialog(arg)
|
no, res = dialog(arg)
|
||||||
|
@ -1953,7 +1988,7 @@ def set_machine(machine):
|
||||||
err += c.args[0] + '\n' # Plus d'IP libres, peut-être à traiter differement ?
|
err += c.args[0] + '\n' # Plus d'IP libres, peut-être à traiter differement ?
|
||||||
try: machine.mac(result[1])
|
try: machine.mac(result[1])
|
||||||
except ValueError, c:
|
except ValueError, c:
|
||||||
if len(c.args)>1 and c.args[1] == 1 and isadm:
|
if len(c.args) > 1 and c.args[1] == 1 and isadm:
|
||||||
# Mac en double
|
# Mac en double
|
||||||
arg = u'--title "Adresse MAC" '
|
arg = u'--title "Adresse MAC" '
|
||||||
arg += u'--yesno "L\'adresse MAC existe déjà, continuer ? \n" 0 0'
|
arg += u'--yesno "L\'adresse MAC existe déjà, continuer ? \n" 0 0'
|
||||||
|
@ -1966,7 +2001,7 @@ def set_machine(machine):
|
||||||
err += c.args[0] + '\n'
|
err += c.args[0] + '\n'
|
||||||
except EnvironmentError, c:
|
except EnvironmentError, c:
|
||||||
err += c.args[0] + '\n'
|
err += c.args[0] + '\n'
|
||||||
elif len(c.args)>1 and c.args[1] == 3 and isadm:
|
elif len(c.args) > 1 and c.args[1] == 3 and isadm:
|
||||||
# Mac douteuse
|
# Mac douteuse
|
||||||
arg = u'--title "Adresse MAC" '
|
arg = u'--title "Adresse MAC" '
|
||||||
arg += u'--yesno "L\'adresse MAC ne correspond à aucun constructeur, continuer ? \n" 0 0'
|
arg += u'--yesno "L\'adresse MAC ne correspond à aucun constructeur, continuer ? \n" 0 0'
|
||||||
|
@ -2126,12 +2161,12 @@ def modif_adher(adher):
|
||||||
|
|
||||||
# Préliminaire : si la chambre est inconnue on force la question
|
# Préliminaire : si la chambre est inconnue on force la question
|
||||||
if adher.chbre() == '????':
|
if adher.chbre() == '????':
|
||||||
res= ['Chambre']
|
res = ['Chambre']
|
||||||
arg = u'--title "Modification de %s" ' % adher.Nom()
|
arg = u'--title "Modification de %s" ' % adher.Nom()
|
||||||
arg += u'--msgbox "ERREUR : la chambre de cet adhérent est inconnue !\n\n\n" 0 0'
|
arg += u'--msgbox "ERREUR : la chambre de cet adhérent est inconnue !\n\n\n" 0 0'
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
elif adher.mail() == '':
|
elif adher.mail() == '':
|
||||||
res= ['Mail']
|
res = ['Mail']
|
||||||
arg = u'--title "Modification de %s" ' % adher.Nom()
|
arg = u'--title "Modification de %s" ' % adher.Nom()
|
||||||
arg += u'--msgbox "ERREUR : l\'adresse mail de cet adhérent est inconnue !\n\n\n" 0 0'
|
arg += u'--msgbox "ERREUR : l\'adresse mail de cet adhérent est inconnue !\n\n\n" 0 0'
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
|
@ -2402,7 +2437,7 @@ def select(clas, quoi, mde=''):
|
||||||
si m = ro ouvre l'objet en mode read-only
|
si m = ro ouvre l'objet en mode read-only
|
||||||
"""
|
"""
|
||||||
|
|
||||||
s= ['', '', '', '', '', '', '', '', '', '', '', '', '', '']
|
s = ['', '', '', '', '', '', '', '', '', '', '', '', '', '']
|
||||||
def unicodize(a):
|
def unicodize(a):
|
||||||
try:
|
try:
|
||||||
return unicode(a, 'utf-8')
|
return unicode(a, 'utf-8')
|
||||||
|
@ -2443,10 +2478,11 @@ def select(clas, quoi, mde=''):
|
||||||
dialog(arg)
|
dialog(arg)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
s= []
|
s = []
|
||||||
for i in result:
|
for i in result:
|
||||||
i = i.strip().decode(encoding)
|
i = i.strip().decode(encoding)
|
||||||
if not i: i= u'*'
|
if not i:
|
||||||
|
i = u'*'
|
||||||
s.append(i)
|
s.append(i)
|
||||||
|
|
||||||
# Recherche par adresse mail/login
|
# Recherche par adresse mail/login
|
||||||
|
@ -2501,7 +2537,7 @@ def select(clas, quoi, mde=''):
|
||||||
valid = res['adherent']
|
valid = res['adherent']
|
||||||
if not valid and (res['machine'] or res['facture']):
|
if not valid and (res['machine'] or res['facture']):
|
||||||
# On va récupérer les adhérents correspondants aux machines trouvés
|
# On va récupérer les adhérents correspondants aux machines trouvés
|
||||||
deja= []
|
deja = []
|
||||||
for m in res['machine']:
|
for m in res['machine']:
|
||||||
a = m.proprietaire()
|
a = m.proprietaire()
|
||||||
if a.id() in deja: continue
|
if a.id() in deja: continue
|
||||||
|
@ -2574,7 +2610,7 @@ def select(clas, quoi, mde=''):
|
||||||
# Annulation du choix
|
# Annulation du choix
|
||||||
choix = None
|
choix = None
|
||||||
break
|
break
|
||||||
cprint (u'Répondre O ou N')
|
cprint(u'Répondre O ou N')
|
||||||
# Retour à la confirmation
|
# Retour à la confirmation
|
||||||
|
|
||||||
if choix:
|
if choix:
|
||||||
|
@ -2671,19 +2707,19 @@ def menu_principal():
|
||||||
# Ajout machine, adhérent à choisir
|
# Ajout machine, adhérent à choisir
|
||||||
proprio = select(db, u'adhérent auquel ajouter une machine a')
|
proprio = select(db, u'adhérent auquel ajouter une machine a')
|
||||||
if not proprio: continue
|
if not proprio: continue
|
||||||
choix= 'aMc'
|
choix = 'aMc'
|
||||||
|
|
||||||
elif choix == 'aMC':
|
elif choix == 'aMC':
|
||||||
# Ajout machine, club à choisir
|
# Ajout machine, club à choisir
|
||||||
proprio = select_club(db)
|
proprio = select_club(db)
|
||||||
if not proprio: continue
|
if not proprio: continue
|
||||||
choix= 'aMc'
|
choix = 'aMc'
|
||||||
|
|
||||||
elif choix == 'mM':
|
elif choix == 'mM':
|
||||||
# Modif machine, machine à choisir
|
# Modif machine, machine à choisir
|
||||||
becane = select(db, u'machine à modifier m')
|
becane = select(db, u'machine à modifier m')
|
||||||
if not becane: continue
|
if not becane: continue
|
||||||
choix= 'mMc'
|
choix = 'mMc'
|
||||||
|
|
||||||
elif choix == "mF":
|
elif choix == "mF":
|
||||||
# Modif d'une facture. Choisir facture.
|
# Modif d'une facture. Choisir facture.
|
||||||
|
@ -2702,30 +2738,37 @@ def menu_principal():
|
||||||
# Modif club
|
# Modif club
|
||||||
proprio = select_club(db)
|
proprio = select_club(db)
|
||||||
if not proprio: continue
|
if not proprio: continue
|
||||||
choix= 'mCc'
|
choix = 'mCc'
|
||||||
|
|
||||||
elif choix == 'dA':
|
elif choix == 'dA':
|
||||||
# Destruction adhérent
|
# Destruction adhérent
|
||||||
proprio = select(db, u'adhérent à détruire a')
|
proprio = select(db, u'adhérent à détruire a')
|
||||||
if not proprio: continue
|
if not proprio:
|
||||||
if del_adher(proprio): continue
|
continue
|
||||||
del(proprio) ; proprio= None
|
if del_adher(proprio):
|
||||||
del(becane) ; becane= None
|
continue
|
||||||
|
del proprio
|
||||||
|
proprio = None
|
||||||
|
del becane
|
||||||
|
becane = None
|
||||||
|
|
||||||
elif choix == 'dM':
|
elif choix == 'dM':
|
||||||
# Destruction machine
|
# Destruction machine
|
||||||
becane = select(db, u'machine à détruire m')
|
becane = select(db, u'machine à détruire m')
|
||||||
if not becane: continue
|
if not becane: continue
|
||||||
if del_machine(becane): continue
|
if del_machine(becane): continue
|
||||||
del(becane) ; becane= None
|
del becane
|
||||||
|
becane = None
|
||||||
|
|
||||||
elif choix == 'dC':
|
elif choix == 'dC':
|
||||||
# Destruction club
|
# Destruction club
|
||||||
proprio = select_club(db)
|
proprio = select_club(db)
|
||||||
if not proprio: continue
|
if not proprio: continue
|
||||||
if del_club(proprio): continue
|
if del_club(proprio): continue
|
||||||
del(proprio) ; proprio= None
|
del proprio
|
||||||
del(becane) ; becane= None
|
proprio = None
|
||||||
|
del becane
|
||||||
|
becane = None
|
||||||
|
|
||||||
elif choix == 'dF':
|
elif choix == 'dF':
|
||||||
# Destruction machine
|
# Destruction machine
|
||||||
|
@ -2733,13 +2776,13 @@ def menu_principal():
|
||||||
if not facture: continue
|
if not facture: continue
|
||||||
proprio = facture.proprietaire()
|
proprio = facture.proprietaire()
|
||||||
if del_facture(facture): continue
|
if del_facture(facture): continue
|
||||||
del(facture)
|
del facture
|
||||||
facture = None
|
facture = None
|
||||||
|
|
||||||
proprio.update_adhesion()
|
proprio.update_adhesion()
|
||||||
proprio.update_connexion()
|
proprio.update_connexion()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
del(proprio)
|
del proprio
|
||||||
proprio = None
|
proprio = None
|
||||||
|
|
||||||
elif choix == 'aKM':
|
elif choix == 'aKM':
|
||||||
|
@ -2788,7 +2831,7 @@ def menu_principal():
|
||||||
arg += u'"Wifi" "Machine wireless" '
|
arg += u'"Wifi" "Machine wireless" '
|
||||||
annul, result = dialog(arg)
|
annul, result = dialog(arg)
|
||||||
if annul: continue
|
if annul: continue
|
||||||
choix= result[0]
|
choix = result[0]
|
||||||
else:
|
else:
|
||||||
# Plus de machine fixe possible...
|
# Plus de machine fixe possible...
|
||||||
arg = u'--title "Nouvelle machine" '
|
arg = u'--title "Nouvelle machine" '
|
||||||
|
@ -2820,14 +2863,14 @@ def menu_principal():
|
||||||
continue
|
continue
|
||||||
if set_machine(becane):
|
if set_machine(becane):
|
||||||
# Annulation
|
# Annulation
|
||||||
del(becane)
|
del becane
|
||||||
becane = None
|
becane = None
|
||||||
|
|
||||||
|
|
||||||
if choix == 'mAc':
|
if choix == 'mAc':
|
||||||
# Modif propriétaire courant
|
# Modif propriétaire courant
|
||||||
del(becane)
|
del becane
|
||||||
becane= None
|
becane = None
|
||||||
# Test club
|
# Test club
|
||||||
if isinstance(proprio, Club):
|
if isinstance(proprio, Club):
|
||||||
if modif_club(proprio):
|
if modif_club(proprio):
|
||||||
|
@ -2861,7 +2904,7 @@ def menu_principal():
|
||||||
proprio.update_adhesion()
|
proprio.update_adhesion()
|
||||||
proprio.update_connexion()
|
proprio.update_connexion()
|
||||||
proprio.save()
|
proprio.save()
|
||||||
del(proprio)
|
del proprio
|
||||||
proprio = None
|
proprio = None
|
||||||
|
|
||||||
elif choix == 'mCc':
|
elif choix == 'mCc':
|
||||||
|
|
|
@ -4158,7 +4158,7 @@ class Facture(BaseClasseCrans):
|
||||||
for art in ajoute:
|
for art in ajoute:
|
||||||
if int(art['nombre']) != float(art['nombre']):
|
if int(art['nombre']) != float(art['nombre']):
|
||||||
raise ValueError, u'nombre doit être un entier'
|
raise ValueError, u'nombre doit être un entier'
|
||||||
if round(art['pu'],2) != art['pu']:
|
if round(art['pu'], 2) != art['pu']:
|
||||||
raise ValueError, u'pu ne doit pas avoir plus de 2 chiffres apres la virgule'
|
raise ValueError, u'pu ne doit pas avoir plus de 2 chiffres apres la virgule'
|
||||||
art['nombre'] = int(art['nombre'])
|
art['nombre'] = int(art['nombre'])
|
||||||
if '~~' in ' '.join([unicode(x) for x in art.values()]):
|
if '~~' in ' '.join([unicode(x) for x in art.values()]):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue