fix(shopfloor): Manager Desk crash — domain_unassigned no longer defined

After the release-ready refactor in 11837ed the unassigned/active
split runs in Python on `all_active_wos`, so the old SQL domains
(`domain_unassigned`, `domain_active`) no longer exist — but the KPI
block still referenced them via `MrpWO.search_count(domain_unassigned)`.
Manager page crashed with `name 'domain_unassigned' is not defined`.

Fix: derive the KPIs from the in-memory recordsets we just split, no
re-query. Also documents why we can't SQL-count: x_fc_is_release_ready
is a non-stored compute, so search_count would silently miss the
release-ready predicate.
This commit is contained in:
gsinghpal
2026-04-19 12:56:26 -04:00
parent 11837ed4f5
commit 8fc864623b

View File

@@ -283,9 +283,12 @@ class FpManagerDashboardController(http.Controller):
else:
pending_accept_sos = 0
# KPI counts derived from the in-memory split we already have —
# don't re-query (the release-ready filter is a Python compute,
# not a stored column, so SQL search_count can't see it).
kpis = {
'unassigned_wos': MrpWO.search_count(domain_unassigned),
'active_wos': MrpWO.search_count(domain_active),
'unassigned_wos': len(unassigned_wos),
'active_wos': len(active_wos),
'ready_to_ship_mos': Production.search_count([
('state', '=', 'done'),
]) if 'x_fc_portal_job_id' not in Production._fields