feat(portal): welcome-line summary counts on /my/home + tests
Adds active_job_count, awaiting_review_count, ready_to_ship_count to the dashboard context. Tests verify partition is correct across the fp.portal.job and fp.quote.request state machines. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,20 @@ class FpCustomerPortal(CustomerPortal):
|
||||
)
|
||||
invoice_count = Invoice.search_count(invoice_domain)
|
||||
|
||||
# Welcome-line summary counts (jobs-forward dashboard).
|
||||
active_job_count = Job.search_count([
|
||||
('partner_id', 'child_of', commercial.id),
|
||||
('state', 'in', ['received', 'in_progress', 'quality_check']),
|
||||
])
|
||||
awaiting_review_count = Quote.search_count([
|
||||
('partner_id', 'child_of', commercial.id),
|
||||
('state', '=', 'quoted'),
|
||||
])
|
||||
ready_to_ship_count = Job.search_count([
|
||||
('partner_id', 'child_of', commercial.id),
|
||||
('state', '=', 'ready_to_ship'),
|
||||
])
|
||||
|
||||
values = {
|
||||
'page_name': 'fp_dashboard',
|
||||
'partner': partner,
|
||||
@@ -206,6 +220,10 @@ class FpCustomerPortal(CustomerPortal):
|
||||
# Invoices
|
||||
'recent_invoices': recent_invoices,
|
||||
'invoice_count': invoice_count,
|
||||
# Welcome-line summary
|
||||
'active_job_count': active_job_count,
|
||||
'awaiting_review_count': awaiting_review_count,
|
||||
'ready_to_ship_count': ready_to_ship_count,
|
||||
}
|
||||
return request.render(
|
||||
'fusion_plating_portal.fp_portal_home_dashboard',
|
||||
|
||||
Reference in New Issue
Block a user