Enlève __unicode__ sur generalizedTimeFormat

This commit is contained in:
Pierre-Elliott Bécue 2015-09-26 02:50:09 +02:00
parent 9610cc6b0b
commit c18de85fd2
3 changed files with 15 additions and 6 deletions

View file

@ -16,6 +16,7 @@ import gestion.annuaires_pg
import gestion.hptools2 as hptools2
import lc_ldap.attributs as attributs
import lc_ldap.crans_utils as crans_utils
def try_import(lib):
"""
@ -201,16 +202,21 @@ def list_factures(factures, width=None):
data = []
for facture in factures:
controle = facture.get('controle', [""])[0]
if controle == "TRUE":
if controle == u"TRUE":
controle = style(u"Validée", "vert")
elif controle == "FALSE":
elif controle == u"FALSE":
controle = style(u"Invalide", "rouge")
else:
controle = u"N/A"
if facture.get('recuPaiement', []):
_dtime = crans_utils.datetime_from_generalized_time_format(unicode(facture.get('recuPaiement', [attributs.recuPaiement.default])[0]))
_recu = _dtime.strftime("%d/%m/%Y %H:%M:%S")
else:
_recu = False
data.append([
facture['fid'][0],
facture['modePaiement'][0],
style(facture.get('recuPaiement', [])[0], "vert") if facture.get('recuPaiement', []) else style("NON", "rouge"),
style(_recu, 'vert') if _recu else style(u"NON", 'rouge'),
controle,
' '.join(attr['code'] for attr in facture.get('article',[])),
u"%s €" % sum([float(a['pu'])*int(a['nombre']) for a in facture.get('article',[])])