Report log

This commit is contained in:
Mauricio Baeza 2021-02-10 22:50:05 -06:00
parent 892906c46f
commit 66d740e8d1
1 changed files with 7 additions and 1 deletions

View File

@ -10525,6 +10525,7 @@ def _import_clients(rfc, path):
data = utils.read_csv(path)
t = len(data)
ok = 0
for i, row in enumerate(data):
msg = f'\tImportando cliente {i+1} de {t}'
log.info(msg)
@ -10534,7 +10535,7 @@ def _import_clients(rfc, path):
w = ((Socios.rfc==row['rfc']) & (Socios.slug==row['slug']))
if Socios.select().where(w).exists():
msg = 'Ya existe el RFC y Razón Social'
msg = '\tYa existe el RFC y Razón Social'
log.info(msg)
continue
@ -10543,11 +10544,16 @@ def _import_clients(rfc, path):
try:
obj = Socios.create(**row)
ok += 1
except Exception as e:
log.error(e)
break
desconectar()
msg = f'Total de clientes: {t}'
log.info(msg)
msg = f'Clientes nuevos: {ok}'
log.info(msg)
log.info('Proceso terminado correctamente...')
return