Propagate sin_contrato_set to transaccion and test-rda routes

All generar_rda_paciente calls in transaccion.py (4) and test_rda.py (2)
now pass sin_contrato_set so contract 040 sends numeroContrato: null
consistently across all send paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-11 09:22:00 -05:00
co-authored by Claude Sonnet 4.6
parent c18da17317
commit 3d848fbf2d
2 changed files with 9 additions and 5 deletions
+5 -2
View File
@@ -8,7 +8,7 @@ from app.auth import get_current_user
from app.services.firebird_service import get_firebird_from_config
from app.services.json_generator import generar_rda_paciente, agrupar_por_recepcion
from app.services.api_client import get_tns_token, TNS_BASE
from app.routes.contratos import load_contrato_map, load_excluded_set
from app.routes.contratos import load_contrato_map, load_excluded_set, load_sin_contrato_set
from app.utils.activity import log_activity, get_ip
router = APIRouter(prefix="/transaccion", tags=["transaccion"])
@@ -106,7 +106,7 @@ async def preview_transaccion(
enviado = _is_sent(id_rec)
cod_c = str(grupo_rows[0].get("CODCONTRATO") or "").strip()
is_excluded = cod_c in excluded
rda = generar_rda_paciente(grupo_rows, prof_def, esp_def, remis_def, prefijo_def, contrato_map=contrato_map)
rda = generar_rda_paciente(grupo_rows, prof_def, esp_def, remis_def, prefijo_def, contrato_map=contrato_map, sin_contrato_set=load_sin_contrato_set())
items.append({
"idrecepcion": id_rec,
"factura": grupo_rows[0].get("NUM_FACTURA", ""),
@@ -180,6 +180,7 @@ async def send_one(
cfg.get("prefijo_tns_default", "00"),
numero_override_one,
contrato_map=load_contrato_map(),
sin_contrato_set=load_sin_contrato_set(),
)
raw_resp = ""
@@ -283,6 +284,7 @@ async def send_transaccion(
cfg.get("prefijo_tns_default", "00"),
numero_override,
contrato_map=contrato_map,
sin_contrato_set=load_sin_contrato_set(),
)
raw_resp = ""
ok_rda = False
@@ -394,6 +396,7 @@ async def send_direct(
cfg.get("prefijo_tns_default", "00"),
num_fac,
contrato_map=contrato_map,
sin_contrato_set=load_sin_contrato_set(),
)
raw_resp = ""
ok_rda = False