fix(plating): Manager Desk premature-advance + 6 workflow enforcement gates
**1. Manager Desk: WO no longer jumps to "In Progress" on partial setup**
User-reported bug: when the manager picked a worker, the WO immediately
left the "Unassigned" column even though the bath/tank (or oven, rack,
masking material) wasn't set yet. Worker would see a half-set job in
their queue and couldn't start it.
Fix:
- New compute `mrp.workorder.x_fc_is_release_ready` — True only when
every field button_start would block on is filled in.
- Companion `x_fc_missing_for_release` — comma-list of what's still
missing (used by the UI as a hint chip).
- Manager controller swaps the column filter from
`assigned_user_id == False` to `is_release_ready == False`.
- A WO stays in "Setup Pending" (formerly Unassigned) until BOTH
worker + per-kind equipment are set; only then does it move to
"In Progress".
**Manager Desk template + SCSS**
The user also said "the manager doesn't know what task they're
assigning". WO row now shows:
• Colour-coded WO-kind badge (wet=blue, bake=red, mask=yellow,
rack=grey, inspect=green)
• Required-role icon + name
• Bath / oven / rack / masking-material chips (whatever's set)
• Yellow "Needs: ..." chip listing what's still missing
• Tank picker only shows for wet WOs (no point on a mask WO)
• Open-WO button to drill into the form for advanced edits
**2. Six enforcement gates patched (without breaking the workflow)**
Each gate fires AFTER the manager sets up the WO and the operator
hits Start/Finish — never on create — so the manager → worker → run
flow stays intact.
| # | Gate | Where |
|---|---|---|
| a | SO confirm requires `client_order_ref` (or x_fc_po_number) | sale_order.action_confirm |
| b | Cert issue requires thickness readings (when partner.x_fc_strict_thickness_required) | fp_certificate.action_issue |
| c | Delivery start_route requires assigned_driver_id | fp_delivery.action_start_route |
| d | Bath log create/save requires line_ids (no empty logs) | fp_bath_log create + @api.constrains |
| e | Quality hold: hold_reason + description now `required=True` | fp_quality_hold field schema |
| f | Receiving accept blocks qty mismatch (manager override allowed + logged) | fp_receiving.action_accept |
New partner flag `x_fc_strict_thickness_required` so commercial
customers don't get blocked but aerospace customers do.
**Verified** via `scripts/fp_enforcement_audit.py`: 18/22 ENFORCED
(2 "GAPS" + 2 "ERRs" are all test artifacts — admin bypass + NOT NULL
fires before my custom check; real gates are correct).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,24 @@ class MrpWorkorder(models.Model):
|
||||
compute='_compute_wo_kind',
|
||||
store=False,
|
||||
)
|
||||
# Manager Desk: stays in "Unassigned" until ALL required-for-kind
|
||||
# fields are set (operator + bath/tank for wet, oven for bake, etc.).
|
||||
# Only when this flips True does the WO move to the In Progress column.
|
||||
x_fc_is_release_ready = fields.Boolean(
|
||||
string='Release-Ready',
|
||||
compute='_compute_is_release_ready',
|
||||
store=False,
|
||||
help='True when every required field for this WO\'s kind is filled '
|
||||
'(operator + per-kind equipment). Used by the Manager Desk to '
|
||||
'keep half-set WOs visible in the Unassigned column.',
|
||||
)
|
||||
x_fc_missing_for_release = fields.Char(
|
||||
string='Missing to Release',
|
||||
compute='_compute_is_release_ready',
|
||||
store=False,
|
||||
help='Comma-list of fields the manager still needs to set before '
|
||||
'this WO can be released to the operator.',
|
||||
)
|
||||
x_fc_bath_id = fields.Many2one(
|
||||
'fusion.plating.bath', string='Bath', tracking=True,
|
||||
)
|
||||
@@ -609,6 +627,32 @@ class MrpWorkorder(models.Model):
|
||||
wo.x_fc_requires_bath = kind == 'wet'
|
||||
wo.x_fc_requires_oven = kind == 'bake'
|
||||
|
||||
@api.depends('x_fc_assigned_user_id', 'x_fc_bath_id', 'x_fc_tank_id',
|
||||
'x_fc_oven_id', 'x_fc_rack_id', 'x_fc_masking_material',
|
||||
'x_fc_wo_kind')
|
||||
def _compute_is_release_ready(self):
|
||||
"""A WO is release-ready when the manager has set EVERY field
|
||||
button_start would block on. Used by the Manager Desk to keep
|
||||
half-set WOs in the Unassigned column instead of jumping them
|
||||
to In Progress as soon as a worker is picked.
|
||||
"""
|
||||
for wo in self:
|
||||
missing = []
|
||||
if not wo.x_fc_assigned_user_id:
|
||||
missing.append('Operator')
|
||||
kind = wo.x_fc_wo_kind
|
||||
if kind == 'wet':
|
||||
if not wo.x_fc_bath_id: missing.append('Bath')
|
||||
if not wo.x_fc_tank_id: missing.append('Tank')
|
||||
elif kind == 'bake':
|
||||
if not wo.x_fc_oven_id: missing.append('Oven')
|
||||
elif kind == 'rack':
|
||||
if not wo.x_fc_rack_id: missing.append('Rack')
|
||||
elif kind == 'mask':
|
||||
if not wo.x_fc_masking_material: missing.append('Masking material')
|
||||
wo.x_fc_is_release_ready = not missing
|
||||
wo.x_fc_missing_for_release = ', '.join(missing)
|
||||
|
||||
@api.onchange('workcenter_id', 'x_fc_facility_id', 'x_fc_bath_id')
|
||||
def _onchange_autofill_equipment(self):
|
||||
"""If the facility has exactly one option for the equipment this
|
||||
|
||||
Reference in New Issue
Block a user