From 8fc864623bea163eabc512e57035e5ff6e1ee95a Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 12:56:26 -0400 Subject: [PATCH] =?UTF-8?q?fix(shopfloor):=20Manager=20Desk=20crash=20?= =?UTF-8?q?=E2=80=94=20domain=5Funassigned=20no=20longer=20defined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../controllers/manager_controller.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fusion_plating/fusion_plating_shopfloor/controllers/manager_controller.py b/fusion_plating/fusion_plating_shopfloor/controllers/manager_controller.py index 3cd789bd..6befa601 100644 --- a/fusion_plating/fusion_plating_shopfloor/controllers/manager_controller.py +++ b/fusion_plating/fusion_plating_shopfloor/controllers/manager_controller.py @@ -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