Add option for import clients
This commit is contained in:
parent
3cdbe14287
commit
4f40bc3bfa
|
@ -18,6 +18,7 @@
|
|||
|
||||
import base64
|
||||
import collections
|
||||
import csv
|
||||
import datetime
|
||||
import getpass
|
||||
import json
|
||||
|
|
|
@ -10505,6 +10505,30 @@ def _migrate_cert(rfc):
|
|||
return
|
||||
|
||||
|
||||
def _import_clients(rfc, path):
|
||||
if not rfc:
|
||||
msg = 'El RFC es requerido'
|
||||
log.error(msg)
|
||||
return
|
||||
|
||||
if not path:
|
||||
msg = 'El archivo CSV es necesario'
|
||||
log.error(msg)
|
||||
return
|
||||
|
||||
args = util.get_con(rfc)
|
||||
if not args:
|
||||
return
|
||||
|
||||
conectar(args)
|
||||
log.info('Importando clientes...')
|
||||
|
||||
|
||||
desconectar()
|
||||
log.info('Proceso terminado correctamente...')
|
||||
return
|
||||
|
||||
|
||||
def _test(rfc):
|
||||
if not rfc:
|
||||
rfc = input('Introduce el RFC: ').strip().upper()
|
||||
|
@ -10529,8 +10553,6 @@ def _test(rfc):
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
def _process_command_line_arguments():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Empresa Libre')
|
||||
|
@ -10554,11 +10576,13 @@ def _process_command_line_arguments():
|
|||
action='store_true', default=False, required=False)
|
||||
parser.add_argument('-ed', '--export-documents', dest='export_documents',
|
||||
action='store_true', default=False, required=False)
|
||||
|
||||
parser.add_argument('-ic', '--import-clients', dest='import_clients',
|
||||
action='store_true', default=False, required=False)
|
||||
parser.add_argument('-mc' , '--migrate-cert', dest='migrate_cert',
|
||||
action='store_true', default=False, required=False)
|
||||
|
||||
parser.add_argument('-r', '--rfc', dest='rfc', default='')
|
||||
parser.add_argument('-f', '--file', dest='file', default='')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
@ -10603,6 +10627,10 @@ def main(args):
|
|||
_migrate_cert(args.rfc)
|
||||
return
|
||||
|
||||
if args.import_clients:
|
||||
_import_clients(args.rfc, args.file)
|
||||
return
|
||||
|
||||
# ~ _test(args.rfc)
|
||||
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue