Compare commits

..

No commits in common. "daf57066db262940ef1847626e5c08762fa038db" and "ef315b147901918cf87610d4e0a1c2ca1ff00865" have entirely different histories.

4 changed files with 4 additions and 6 deletions

View File

@ -17,7 +17,7 @@ def get_factuges_connection(config) -> fdb.Connection:
database=config['FACTUGES_DATABASE'], database=config['FACTUGES_DATABASE'],
user=config['FACTUGES_USER'], user=config['FACTUGES_USER'],
password=config['FACTUGES_PASSWORD'], password=config['FACTUGES_PASSWORD'],
charset='ISO8859_1' charset='UTF8',
) )
logger.info( logger.info(
"Conexión a la base de datos FactuGES establecida: %s with database:%s - using user:%s", "Conexión a la base de datos FactuGES establecida: %s with database:%s - using user:%s",

View File

@ -17,7 +17,6 @@ from app.utils import (
normalizar_telefono_con_plus, normalizar_telefono_con_plus,
normalizar_url_para_insert, normalizar_url_para_insert,
tax_fraction_from_code, tax_fraction_from_code,
text_converter,
unscale_to_decimal, unscale_to_decimal,
) )
@ -47,7 +46,7 @@ def normalize_customer_fields(fd: Dict[str, Any]) -> Dict[str, Any]:
"is_company": config["CTE_IS_COMPANY"], "is_company": config["CTE_IS_COMPANY"],
"tin": clean_tin(str(fd.get("NIF_CIF"))), "tin": clean_tin(str(fd.get("NIF_CIF"))),
"name": fd.get("NOMBRE"), "name": fd.get("NOMBRE"),
"street": text_converter(fd.get("CALLE")), "street": fd.get("CALLE"),
"city": fd.get("POBLACION"), "city": fd.get("POBLACION"),
"province": fd.get("PROVINCIA"), "province": fd.get("PROVINCIA"),
"postal_code": fd.get("CODIGO_POSTAL"), "postal_code": fd.get("CODIGO_POSTAL"),

View File

@ -73,7 +73,7 @@ def insert_item_and_taxes(fields) -> Dict[str, Any]:
"item_discount_amount_value": str(none_to_empty(fields.get("item_discount_amount_value"))), "item_discount_amount_value": str(none_to_empty(fields.get("item_discount_amount_value"))),
"global_discount_percentage_value": str(none_to_empty(fields.get("global_discount_percentage_value"))), "global_discount_percentage_value": str(none_to_empty(fields.get("global_discount_percentage_value"))),
"global_discount_amount_value": str(none_to_empty(fields.get("global_discount_amount_value"))), "global_discount_amount_value": str(none_to_empty(fields.get("global_discount_amount_value"))),
"total_discount_amount_value": str(none_to_empty(fields.get("total_discount_amount_value"))), "total_discount_amount_value": str(fields.get("total_discount_amount_value")),
"taxable_amount_value": str(fields.get("taxable_amount_value")), "taxable_amount_value": str(fields.get("taxable_amount_value")),
"total_amount_value": str(fields.get("total_amount_value")), "total_amount_value": str(fields.get("total_amount_value")),
"iva_code": str(fields.get("iva_code")), "iva_code": str(fields.get("iva_code")),

View File

@ -1,5 +1,4 @@
import re import re
from app.config import logger from app.config import logger
@ -21,7 +20,7 @@ def text_converter(texto, charset_destino='ISO8859_1', longitud_maxima=None):
try: try:
# Convertir el texto al charset especificado # Convertir el texto al charset especificado
texto_convertido = texto.encode( texto_convertido = texto.encode(
charset_destino, 'ignore').decode("cp1252") charset_destino, 'ignore').decode(charset_destino)
# Si se especifica una longitud máxima, truncar el texto # Si se especifica una longitud máxima, truncar el texto
if longitud_maxima and len(texto_convertido) > longitud_maxima: if longitud_maxima and len(texto_convertido) > longitud_maxima: