From f4f135ba29a7c68ec569d1b35b1898974894d73f Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 28 Jul 2026 19:07:27 -0500 Subject: [PATCH] fix: add ?codigosucursal to Ventas/Crear URL in ventas.py Co-Authored-By: Claude Sonnet 4.6 --- app/routes/ventas.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/routes/ventas.py b/app/routes/ventas.py index 361c244..2252da3 100644 --- a/app/routes/ventas.py +++ b/app/routes/ventas.py @@ -236,7 +236,8 @@ async def send_one( return JSONResponse({"success": False, "message": f"Error login TNS: {token_err}"}) headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} - endpoint = f"{TNS_BASE}/v2/facturacion/Ventas/Crear" + api_sucursal = cfg.get("api_sucursal", "") or "00" + endpoint = f"{TNS_BASE}/v2/facturacion/Ventas/Crear?codigosucursal={api_sucursal}" venta_json = _build_venta(grupo_rows, cfg) contrato = str(grupo_rows[0].get("CODCONTRATO") or "").strip() @@ -287,7 +288,8 @@ async def send_ventas( return JSONResponse({"success": False, "message": f"Error login TNS: {token_err}"}) headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} - endpoint = f"{TNS_BASE}/v2/facturacion/Ventas/Crear" + api_sucursal = cfg.get("api_sucursal", "") or "00" + endpoint = f"{TNS_BASE}/v2/facturacion/Ventas/Crear?codigosucursal={api_sucursal}" resultados = [] async with httpx.AsyncClient(timeout=int(cfg.get("api_timeout", 30))) as client: