fix: Corregir parámetros incorrectos en generación de PDF

- generar_reporte_diario() y generar_reporte_ejecutivo() esperan
  (ventas, stats) pero se estaba pasando (ventas, ranking, stats)
- Esto causaba error "'list' object has no attribute 'get'"
- También pasar vendedor al reporte diario cuando aplique

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 04:18:06 +00:00
parent 2895bdafa2
commit b526fe6c06

View File

@@ -1008,10 +1008,10 @@ def comando_reporte():
}
if tipo == 'ejecutivo':
pdf_content = generar_reporte_ejecutivo(ventas, ranking, stats)
pdf_content = generar_reporte_ejecutivo(ventas, stats)
filename = f"reporte_ejecutivo_{datetime.now(TZ_MEXICO).strftime('%Y%m%d')}.pdf"
else:
pdf_content = generar_reporte_diario(ventas, ranking, stats)
pdf_content = generar_reporte_diario(ventas, stats)
filename = f"reporte_{tipo}_{datetime.now(TZ_MEXICO).strftime('%Y%m%d')}.pdf"
# Subir PDF a Mattermost
@@ -1074,9 +1074,9 @@ def api_reports_generate():
# Generar PDF
if tipo == 'executive':
pdf_content = generar_reporte_ejecutivo(ventas, ranking, stats)
pdf_content = generar_reporte_ejecutivo(ventas, stats)
else:
pdf_content = generar_reporte_diario(ventas, ranking, stats)
pdf_content = generar_reporte_diario(ventas, stats, vendedor)
# Guardar temporalmente y devolver ID
import hashlib