fix(manager-desk): include 'blocked' WOs + populate empty columns

Two complementary fixes — a real bug in the Manager Desk and demo
data that exercises the now-correct view.

The bug
=======
manager_controller.py used an explicit allow-list of WO states for
its Unassigned / Active columns and for the per-operator team load
count: ('pending','waiting','ready','progress'). That set MISSED the
'blocked' state Odoo emits when a WO's predecessor isn't done yet.

Result: an MO whose first WO is still running has all its downstream
WOs in 'blocked' state. They literally don't appear on the Manager
Desk — neither in "Needs a Worker" (even when unassigned) nor in
"In Progress" (even when assigned). The team load count also
under-reports because the operator's blocked queue is invisible.

Fix: switch all three domains from an allow-list to a deny-list
('done','cancel'). Same shape Plant Overview already uses, so the
two dashboards now agree on what "active" means.

Demo data
=========
Stage-filler gains two steps so the now-corrected view has obvious
data:

  6e. _populate_active_wos walks the in-flight MO's blocked routing
      and explicitly assigns the seven downstream WOs in sequence
      order — Diego (training), Carlos (plating), James (demask),
      Priya (oven), TWO unassigned (de-rack + post-bake — feed
      "Needs a Worker"), Aisha (final inspection). Earlier
      keyword-fuzzy matching missed WOs whose names didn't carry
      the expected substring.

  6f. _mark_so_awaiting_manager pushes two confirmed SOs to
      receiving_status='inspected' + assigned_manager_id=False so
      the "Awaiting Assignment" KPI is non-zero.

Verified on entech: 2 unassigned WOs, 6 active+assigned, 2
awaiting-assignment SOs. Six of seven operators carry at least one
open queue item; Marie has zero current load but a healthy past
completion history (she's on shift, between jobs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-18 22:32:53 -04:00
parent 0315fee988
commit 2ce7bd3665
2 changed files with 102 additions and 3 deletions

View File

@@ -59,8 +59,14 @@ class FpManagerDashboardController(http.Controller):
has_assign = 'x_fc_assigned_user_id' in MrpWO._fields
# ---- Column 1: Unassigned (no worker on an active WO) ----------
# 'not in (done, cancel)' rather than an explicit allow-list so
# we catch every active state Odoo emits — including 'blocked'
# (predecessor not done yet). The previous allow-list missed
# 'blocked' and left the column empty for entire MO routings
# whose first WO was still running.
ACTIVE_NEG_STATES = ('done', 'cancel')
domain_unassigned = [
('state', 'in', ('pending', 'waiting', 'ready', 'progress')),
('state', 'not in', ACTIVE_NEG_STATES),
]
if has_assign:
domain_unassigned.append(('x_fc_assigned_user_id', '=', False))
@@ -137,8 +143,12 @@ class FpManagerDashboardController(http.Controller):
unassigned_cards.append(_mo_card(mo, wos))
# ---- Column 2: In Progress (MOs with at least one active WO) ----
# Same widening as the unassigned domain — capture every active
# state. Without 'blocked' in the set, an MO whose only running
# WO is currently blocked-waiting-on-predecessor disappears from
# the column even though the assigned worker is still on point.
domain_active = [
('state', 'in', ('ready', 'progress')),
('state', 'not in', ACTIVE_NEG_STATES),
]
if has_assign:
domain_active.append(('x_fc_assigned_user_id', '!=', False))
@@ -160,7 +170,7 @@ class FpManagerDashboardController(http.Controller):
for user in operator_group.user_ids.sorted('name'):
open_wos = MrpWO.search([
('x_fc_assigned_user_id', '=', user.id),
('state', 'in', ('ready', 'progress', 'waiting')),
('state', 'not in', ACTIVE_NEG_STATES),
])
team.append({
'user_id': user.id,