From ab313996702d9c3deba2478e2832e16959cef771 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Fri, 12 Jan 2018 20:13:44 -0600 Subject: [PATCH] Fix - En categorias nulas al importar --- source/app/controllers/util.py | 2 ++ source/app/models/main.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 896a7d1..4b4f8be 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -2277,6 +2277,8 @@ class ImportFacturaLibre(object): """ for row in rows: new = {t: row[s] for s, t in fields} + if new['categoria'] == 0: + new['categoria'] = None new['descripcion'] = ' '.join(new['descripcion'].split()) new['clave_sat'] = DEFAULT_SAT_PRODUCTO self._cursor.execute(sql, (row['id'],)) diff --git a/source/app/models/main.py b/source/app/models/main.py index fa9fc40..f1adfde 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -5554,7 +5554,7 @@ def _importar_productos(archivo): try: obj = Productos.create(**new) obj.impuestos = taxes - except IntegrityError: + except IntegrityError as e: pass log.info('ImportaciĆ³n terminada...')