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: