feat(pos): add 3 improvements — Spanish translations, PDF quotes, push notifications

1. Spanish translations for TecDoc catalog (translations.py) applied to
   catalog_service.py and dashboard server.py endpoints
2. Printable quotation HTML endpoint (/pos/api/quotations/<id>/pdf) with
   @media print CSS for clean browser-to-PDF output
3. Web Push notifications to owner/admin on sale cancellation, stock zero,
   and cash register differences > $500. Includes service worker, VAPID
   key management, and subscription endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 08:05:11 +00:00
parent c61e58ac6a
commit 5d5a2777eb
11 changed files with 848 additions and 14 deletions

View File

@@ -510,6 +510,19 @@ def cancel_sale(conn, sale_id, reason):
old_value={'status': 'completed', 'total': float(s_total)},
new_value={'status': 'cancelled', 'reason': reason})
# Push notification to owner/admin (best-effort, non-blocking)
try:
from services.push_service import notify_owner
emp_name = getattr(g, 'employee_name', 'Empleado')
notify_owner(
conn,
'Venta Cancelada',
f'Venta #{sale_id} (${float(s_total):,.2f}) cancelada por {emp_name}: {reason}',
'/pos'
)
except Exception:
pass # Push failures never block business logic
cur.close()
return {