feat: excluir contratos del envío TNS

- Columna excluir en tabla contratos (migración automática)
- 25 contratos nuevos sembrados con excluir=1 (laboratorios externos, clínicas, médicos particulares)
- load_excluded_set() en contratos.py para consultar el set en runtime
- preview: marca items excluidos y los reporta en el conteo
- send/send-one/send-direct: bloquea envío si contrato está excluido
- automation preview+run: filtra excluidos antes del loop, reporta count
- UI /contratos: columna Envío TNS con toggle Activo/Excluido, fila en rojo si excluida

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-10 15:44:26 -05:00
co-authored by Claude Sonnet 4.6
parent 3baa6e5f75
commit 200a3f550b
5 changed files with 156 additions and 37 deletions
+5
View File
@@ -31,9 +31,14 @@ def _migrate(conn):
nit_empresa TEXT NOT NULL DEFAULT '',
tipo_usuario TEXT NOT NULL,
descripcion TEXT NOT NULL DEFAULT '',
excluir INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
)
""")
else:
contrato_cols = {r[1] for r in conn.execute("PRAGMA table_info(contratos)")}
if "excluir" not in contrato_cols:
conn.execute("ALTER TABLE contratos ADD COLUMN excluir INTEGER NOT NULL DEFAULT 0")
conn.commit()