feat(quality_dashboard): sixth 'Certificates' tab (Tasks 14-16)

Counts endpoint: certificates block — open=draft, overdue=draft+>24h.
Falls back to {open:0, overdue:0} when fp.certificate isn't installed.

JS: TABS array gains the 6th entry. Existing data-driven OWL template
auto-renders both the header tile and the body panel. Tab opens the
fp.certificate kanban grouped by state, filtered to draft by default.

Deep-link: setup() reads action.context.params.tab. The
cert_awaiting_issuance notification email links to
/odoo/action-fp_quality_dashboard?tab=certificates and lands the QM
on the right tab automatically.

Template: 'Open across all 5' → 'Open across all <tabs.length>' so
it stays correct if more tabs are added later.

Manifest: fusion_plating_quality 19.0.6.6.6 → 19.0.7.0.0
(fusion_plating_certificates already in depends — no change needed).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-25 09:49:10 -04:00
parent 3a120dd400
commit c00831a72a
4 changed files with 27 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ class FpQualityDashboardController(http.Controller):
- CAPA: due_date < today AND state not in (effective, closed)
- RMA: state='received' for > 5 days (triage past due) OR
state in (authorised, shipped_to_us) for > 14 days
- Certificate: state='draft' for > 1 day (spec 2026-05-25)
"""
env = request.env
today = fields.Date.context_today(env.user)
@@ -33,6 +34,7 @@ class FpQualityDashboardController(http.Controller):
Ncr = env['fusion.plating.ncr']
Capa = env['fusion.plating.capa']
Rma = env['fusion.plating.rma']
Cert = env['fp.certificate'] if 'fp.certificate' in env else None
d3 = fields.Datetime.subtract(now, days=3)
d1 = fields.Datetime.subtract(now, days=1)
@@ -87,4 +89,12 @@ class FpQualityDashboardController(http.Controller):
('create_date', '<', d14),
]),
},
# Spec 2026-05-25 — Certificates tab
'certificates': ({
'open': Cert.search_count([('state', '=', 'draft')]),
'overdue': Cert.search_count([
('state', '=', 'draft'),
('create_date', '<', d1),
]),
} if Cert is not None else {'open': 0, 'overdue': 0}),
}