diff --git a/.gitignore b/.gitignore index f850e79..e6db0be 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ source/media # Sphinx documentation docs/ -*.ods *.xlsx credenciales.conf diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 3512985..6728ba3 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -1460,11 +1460,12 @@ class ImportFacturaLibre(object): return data def _categorias(self): - sql = "SELECT * FROM categorias" + sql = "SELECT * FROM categorias ORDER BY id_padre" self._cursor.execute(sql) rows = self._cursor.fetchall() fields = ( + ('id', 'id'), ('categoria', 'categoria'), ('id_padre', 'padre'), ) @@ -1561,9 +1562,11 @@ class ImportFacturaLibre(object): tasas = { '16': 0.16, + '11': 0.11, '-10': 0.10, '0': 0.0, '-2/3': 0.666667, + '-0.5': 0.005, } data = [] diff --git a/source/app/models/main.py b/source/app/models/main.py index 80503f2..ce1296c 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -3222,7 +3222,6 @@ class FacturasPagos(BaseModel): auto_round=True) saldo = DecimalField(default=0.0, max_digits=18, decimal_places=6, auto_round=True) - # ~ cancelado = BooleanField(default=False) class Meta: order_by = ('factura',) @@ -3351,16 +3350,16 @@ def authenticate(args): respuesta = {'login': False, 'msg': 'No Autorizado', 'user': ''} values = util.get_con(args['rfc']) if not values: - return respuesta + return respuesta, None conectar(values) try: obj = Usuarios.get(usuario=args['usuario'], es_activo=True) except Usuarios.DoesNotExist: - return respuesta + return respuesta, None if not obj.contraseña.check_password(args['contra']): - return respuesta + return respuesta, None obj.ultimo_ingreso = util.now() obj.save() @@ -3756,6 +3755,7 @@ def _importar_facturas(rows): except IntegrityError as e: msg = '\tFactura: id: {}'.format(row['serie'] + str(row['folio'])) log.error(msg) + log.info('\tFacturas importadas...') return @@ -3763,25 +3763,24 @@ def _importar_facturas(rows): def _importar_categorias(rows): log.info('\tImportando Categorías...') for row in rows: - if row['padre'] is None: - filters = ( - (Categorias.categoria==row['categoria']) & - (Categorias.padre.is_null(True)) - ) - else: - filters = ( - (Categorias.categoria==row['categoria']) & - (Categorias.padre==row['padre']) - ) - - if Categorias.exists(filters): - continue - - try: - Categorias.create(**row) - except IntegrityError: - msg = '\tCategoria: ({}) {}'.format(row['padre'], row['categoria']) - log.error(msg) + # ~ if row['padre'] is None: + # ~ filters = ( + # ~ (Categorias.categoria==row['categoria']) & + # ~ (Categorias.padre.is_null(True)) + # ~ ) + # ~ else: + # ~ filters = ( + # ~ (Categorias.categoria==row['categoria']) & + # ~ (Categorias.padre==row['padre']) + # ~ ) + with database_proxy.atomic() as txn: + # ~ if Categorias.exists(filters): + # ~ continue + try: + Categorias.create(**row) + except IntegrityError: + msg = '\tCategoria: ({}) {}'.format(row['padre'], row['categoria']) + log.error(msg) log.info('\tCategorías importadas...') return diff --git a/source/templates/plantilla_factura.ods b/source/templates/plantilla_factura.ods new file mode 100644 index 0000000..df899a1 Binary files /dev/null and b/source/templates/plantilla_factura.ods differ