feat: paso 4 ventas en automation + fixes varios

- Automation: agrega Paso 4 (Ventas/Crear) con fetch _SQL_VENTAS,
  filtro por excluded_ventas_set, loop de envío y log de actividad
- Automation: _guardar_envio ahora almacena idrecepcion y contrato
  para que /ventas reconozca registros enviados por automation
- Contratos: corrige NameError en toggle_excluir (faltaba request: Request)
- Ventas: agrega check if not q en send_one y send para evitar TypeError
- Ventas HTML: agrega columna Contrato en la tabla de facturas
- json_generator: normaliza etnia >2 chars a '99' (ej: 999 → 99)
- json_generator: agrega campo ciudadExp usando el mismo cod_ciudad

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-11 14:29:39 -05:00
co-authored by Claude Sonnet 4.6
parent 21eb99d18d
commit 73062af8bc
7 changed files with 249 additions and 68 deletions
+2 -1
View File
@@ -106,7 +106,8 @@ def generar_tercero_api(row: dict) -> dict:
"sexo": sexo,
"identidadGenero": identidad_genero,
"zona": zona,
"etnia": str(row.get("CODETNIA") or "99").strip(),
"etnia": (lambda v: v if v and len(v) <= 2 else "99")(str(row.get("CODETNIA") or "").strip()),
"ciudadExp": cod_ciudad,
"antecedentes": "",
"cliente": "S",
"enfermedadCronica": False,