[gnst_crans/vente] Possibilité de "vente" de choses sans prix unitaire

par exemple un rechargement de solde
This commit is contained in:
Valentin Samir 2014-01-26 03:19:58 +01:00
parent 3eea38d69c
commit b65f9ebc9a
3 changed files with 39 additions and 19 deletions

View file

@ -983,7 +983,10 @@ def set_vente(proprio):
for key, value in items.iteritems():
if value['imprimeur'] and not isimprimeur:
continue
checklist.append(u'"%s" "%s (%s€)" "%s"' % (key, value['designation'], value['pu'], on_off(False)))
if value['pu'] != '*':
checklist.append(u'"%s" "%s (%s€)" "%s"' % (key, value['designation'], value['pu'], on_off(False)))
else:
checklist.append(u'"%s" "%s" "%s"' % (key, value['designation'], on_off(False)))
if not checklist:
# Il n'y a rien de modifiable
@ -1005,19 +1008,34 @@ def set_vente(proprio):
for key in items.keys():
if '%s\n' % key in result:
while 1:
arg = u'--title "Nombre de %s ?" ' % items[key]['designation']
arg += u'--inputbox "" 0 0 "1" '
annul, res = dialog(arg)
if annul: return 1
try:
nombre=int(res[0])
break
except ValueError, c:
arg = u'--title "Opération impossible" '
arg += u'--msgbox "%s\n\n\n" 0 0' % to_unicode(c.args[0])
dialog(arg)
f.ajoute({'nombre': nombre, 'code': key, 'designation': items[key]['designation'], 'pu': items[key]['pu']})
if items[key]['pu'] != '*':
arg = u'--title "Nombre de %s ?" ' % items[key]['designation']
arg += u'--inputbox "" 0 0 "1" '
annul, res = dialog(arg)
if annul: return 1
try:
nombre=int(res[0])
break
except ValueError, c:
arg = u'--title "Opération impossible" '
arg += u'--msgbox "%s\n\n\n" 0 0' % to_unicode(c.args[0])
dialog(arg)
else:
arg = u'--title "Montant pour %s ?" ' % items[key]['designation']
arg += u'--inputbox "" 0 0 "1" '
annul, res = dialog(arg)
if annul: return 1
try:
nombre=float(res[0])
break
except ValueError, c:
arg = u'--title "Opération impossible" '
arg += u'--msgbox "%s\n\n\n" 0 0' % to_unicode(c.args[0])
dialog(arg)
if items[key]['pu'] != '*':
f.ajoute({'nombre': nombre, 'code': key, 'designation': items[key]['designation'], 'pu': items[key]['pu']})
else:
f.ajoute({'nombre': 1, 'code': key, 'designation': items[key]['designation'], 'pu': nombre})
texte = []
for art in f.articles():