[gnst_crans/vente] Possibilité de "vente" de choses sans prix unitaire
par exemple un rechargement de solde
This commit is contained in:
parent
3eea38d69c
commit
b65f9ebc9a
3 changed files with 39 additions and 19 deletions
|
@ -6,4 +6,6 @@ items = {
|
||||||
'CABLE' : {'designation': u'Cable Ethernet 5m', 'pu': 3, 'imprimeur': False},
|
'CABLE' : {'designation': u'Cable Ethernet 5m', 'pu': 3, 'imprimeur': False},
|
||||||
'ADAPTATEUR' : {'designation': u'Adaptateur Ethernet/USB', 'pu': 17, 'imprimeur': False},
|
'ADAPTATEUR' : {'designation': u'Adaptateur Ethernet/USB', 'pu': 17, 'imprimeur': False},
|
||||||
'RELIURE': {'designation': u'Reliure plastique', 'pu': 0.12, 'imprimeur': False},
|
'RELIURE': {'designation': u'Reliure plastique', 'pu': 0.12, 'imprimeur': False},
|
||||||
|
'DEV~ADHESION':{'designation': u'Adhésion à L\'association pour un an', 'pu':20, 'imprimeur': False},
|
||||||
|
'SOLDE':{'designation': u'Rechargement du solde', 'pu':'*', 'imprimeur': False},
|
||||||
}
|
}
|
||||||
|
|
|
@ -983,7 +983,10 @@ def set_vente(proprio):
|
||||||
for key, value in items.iteritems():
|
for key, value in items.iteritems():
|
||||||
if value['imprimeur'] and not isimprimeur:
|
if value['imprimeur'] and not isimprimeur:
|
||||||
continue
|
continue
|
||||||
|
if value['pu'] != '*':
|
||||||
checklist.append(u'"%s" "%s (%s€)" "%s"' % (key, value['designation'], value['pu'], on_off(False)))
|
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:
|
if not checklist:
|
||||||
# Il n'y a rien de modifiable
|
# Il n'y a rien de modifiable
|
||||||
|
@ -1005,11 +1008,11 @@ def set_vente(proprio):
|
||||||
for key in items.keys():
|
for key in items.keys():
|
||||||
if '%s\n' % key in result:
|
if '%s\n' % key in result:
|
||||||
while 1:
|
while 1:
|
||||||
|
if items[key]['pu'] != '*':
|
||||||
arg = u'--title "Nombre de %s ?" ' % items[key]['designation']
|
arg = u'--title "Nombre de %s ?" ' % items[key]['designation']
|
||||||
arg += u'--inputbox "" 0 0 "1" '
|
arg += u'--inputbox "" 0 0 "1" '
|
||||||
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
|
||||||
|
@ -1017,7 +1020,22 @@ def set_vente(proprio):
|
||||||
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)
|
||||||
|
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']})
|
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 = []
|
texte = []
|
||||||
for art in f.articles():
|
for art in f.articles():
|
||||||
|
|
|
@ -3812,15 +3812,15 @@ class Facture(BaseClasseCrans):
|
||||||
|
|
||||||
# on crédite les articles
|
# on crédite les articles
|
||||||
for art in self._articles():
|
for art in self._articles():
|
||||||
# solde impression
|
# solde impression (on débite d'abord si jamais quelqu'un s'amuse à recharger son solde avec son solde)
|
||||||
|
if self.modePaiement() == 'solde':
|
||||||
|
proprio = self.proprietaire()
|
||||||
|
proprio.solde(operation=0.0 - self.total(), comment="Facture n°%s" % self.numero())
|
||||||
|
proprio.save()
|
||||||
if art["code"] == "SOLDE":
|
if art["code"] == "SOLDE":
|
||||||
proprio = self.proprietaire()
|
proprio = self.proprietaire()
|
||||||
proprio.solde(operation=art['nombre']*art["pu"], comment="Facture n°%s : %s" % (self.numero(), art['designation']))
|
proprio.solde(operation=art['nombre']*art["pu"], comment="Facture n°%s : %s" % (self.numero(), art['designation']))
|
||||||
proprio.save()
|
proprio.save()
|
||||||
elif self.modePaiement() == 'solde':
|
|
||||||
proprio = self.proprietaire()
|
|
||||||
proprio.solde(operation=0.0 - self.total(), comment="Facture n°%s" % self.numero())
|
|
||||||
proprio.save()
|
|
||||||
|
|
||||||
def _frais(self):
|
def _frais(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue