fix: handle Firebird Decimal and datetime types in JSON serialization

- PRECIO and VALORTOTAL are Decimal from fdb driver; convert via _safe_num()
- HORAINICIORECEPCION is a datetime object; use _fmt_hora_str() for HH:MM:SS
- _parse_hora() now handles datetime objects directly (no str() roundtrip)
- Same fixes applied to pacientes.py exam builder
- sync-now endpoint catches exceptions and returns traceback as JSON

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-17 09:10:41 -05:00
co-authored by Claude Sonnet 4.6
parent fc18acc761
commit 863e012c12
3 changed files with 65 additions and 12 deletions
+6 -2
View File
@@ -33,5 +33,9 @@ async def erp_sync_now(
ventana_min: int = Query(default=30, ge=1, le=1440),
user: dict = Depends(get_current_user),
):
resultado = await sync_recientes(ventana_min=ventana_min)
return JSONResponse(resultado)
import traceback as tb
try:
resultado = await sync_recientes(ventana_min=ventana_min)
return JSONResponse(resultado)
except Exception as e:
return JSONResponse({"ok": False, "error": str(e), "traceback": tb.format_exc()}, status_code=200)