fix: generar_factura_venta uses PREFIJO from row, not config default

codigoPrefijo in ventas JSON must be the actual Firebird PREFIJO
(e.g. "CMXC"), not the prefijo_tns_default config value which is
intended for RDA/transaccion. Falls back to default_prefijo if row
has no PREFIJO.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-28 09:59:40 -05:00
co-authored by Claude Sonnet 4.6
parent ae90eaf71c
commit 3a0964e4ec
+3 -1
View File
@@ -295,8 +295,10 @@ def generar_factura_venta(rows: list, default_vendedor: str = "00",
nit_raw = str(h.get("NIT_EMPRESA") or "").strip()
cod_tercero = nit_raw.split("-")[0].strip() if nit_raw else str(h.get("COD_PACIENTE") or "").strip()
prefijo_real = str(h.get("PREFIJO") or "").strip() or default_prefijo or "00"
return _clean_times({
"codigoPrefijo": default_prefijo or "00",
"codigoPrefijo": prefijo_real,
"numero": num_fac,
"numeroFactura": num_fac,
"fecha": fecha,