Fix colisión de numero de factura en TNS cuando varios IDRECEPCION comparten NUM_FACTURA
- json_generator: agrega parámetro numero_override para usar un número alternativo
- test_rda: detecta si el NUM_FACTURA ya fue enviado exitosamente (sesión o rda_test_log) y usa "{factura}-{idrecepcion}" como numero único en TNS
- transaccion: misma lógica en envío masivo, evita que el segundo IDRECEPCION de la misma factura falle con 409
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7e0c6039b8
commit
d9d3deef6c
@@ -97,7 +97,8 @@ def agrupar_por_recepcion(rows: list) -> dict:
|
||||
|
||||
|
||||
def generar_rda_paciente(rows: list, default_profesional: str = "", default_especialidad: str = "",
|
||||
default_remisionante: str = "00", default_prefijo: str = "00") -> dict:
|
||||
default_remisionante: str = "00", default_prefijo: str = "00",
|
||||
numero_override: str = "") -> dict:
|
||||
if not rows:
|
||||
return {}
|
||||
h = rows[0]
|
||||
@@ -159,7 +160,9 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
|
||||
return {
|
||||
"codigoPrefijo": default_prefijo or str(h.get("PREFIJO") or "00").strip(),
|
||||
"numero": str(h.get("NUM_FACTURA") or "").strip() if (h.get("NUM_FACTURA") or 0) != 0 else "",
|
||||
"numero": numero_override if numero_override else (
|
||||
str(h.get("NUM_FACTURA") or "").strip() if (h.get("NUM_FACTURA") or 0) != 0 else ""
|
||||
),
|
||||
"fecha": fecha,
|
||||
"codTercero": str(h.get("COD_PACIENTE") or "").strip(),
|
||||
"codVendedor": "00",
|
||||
|
||||
Reference in New Issue
Block a user