feat(plating): hide quality smart buttons at zero + order-scope NCR/CAPA counts

On the sale.order and fp.job forms, the Holds/Checks/NCRs/CAPAs/RMAs quality
smart buttons (and the SO WO button) now hide when their count is 0, so the row
shows only quality work that exists. NCR and CAPA counts are re-scoped from
customer-wide to order/job via a shared _fp_quality_ncr_ids() helper (NCRs
reached through the order's RMAs + the order/job's holds), so each badge and the
list its button opens always agree. Also aligned the job RMA button's list
domain to its (already SO-scoped) count.

Reverts the Sub-12 Phase D "always-visible (zero is OK)" choice back to the
module's documented hide-at-zero convention.

- fusion_plating_quality 19.0.8.1.0 -> 19.0.8.2.0
- fusion_plating_jobs    19.0.12.4.0 -> 19.0.12.5.0

Deployed + verified on entech (badge == helper across sampled SOs/jobs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-04 20:36:54 -04:00
parent 423f288507
commit c9eb61ee0c
8 changed files with 223 additions and 67 deletions

View File

@@ -460,10 +460,12 @@ invisible="x_fc_ncr_count == 0" <!-- NCRs: only when there are o
Add the supporting boolean / count as a stored or non-stored compute on the model. Group multiple visibility helpers in ONE compute method to keep the `_compute_smart_button_visibility` chain cheap (one pass over `order_line`).
**Quality buttons on `sale.order` + `fp.job` are hide-at-zero (2026-06-04).** The Holds / Checks / NCRs / CAPAs / RMAs row (and the SO `WO` button) all carry `invisible="<count> == 0"`, so the row shows only quality work that exists — the Sub-12 Phase D "always-visible (zero is OK)" choice was reverted to this convention. The **NCR and CAPA counts are order/job-scoped, NOT customer-wide**: a single `_fp_quality_ncr_ids()` helper on both `sale.order` and `fp.job` (`fusion_plating_quality/models/fp_quality_smart_buttons.py`) returns NCRs reached via the order's RMAs (`ncr.rma_id`) + NCRs spawned from the order's/job's holds (`hold.ncr_id`); the badge count AND the button's action-window domain both read that helper, so they always agree. There is no `ncr.sale_order_id` / `ncr.job_id` field — those two paths are the only honest order links, so an NCR with neither (a QA-team-logged customer NCR) stays off the order/job by design. Don't restore the customer-wide union or the always-visible buttons.
### Ordering / placement
- **Always-visible meaningful buttons go first** — they're the workflow signals an operator scans for first (Receiving, Plating Jobs, Holds, Checks).
- **NCRs / RMAs sit in the middle** — visible only when present (so they pop only when there's actual quality work).
- **Always-visible meaningful buttons go first** — they're the workflow signals an operator scans for first (Receiving, WO/Plating Jobs).
- **Quality buttons (Holds, Checks, NCRs, CAPAs, RMAs) are hidden when their count is 0** — they pop only when there's actual quality work on the order/job.
- **Conditional / multi-lens analytical buttons go LAST** (BOM Items, By Job Group). They overflow into the `More ▾` dropdown when the row is full, which is fine — they're the "I'm zooming into a complex SO" tools, not the daily-driver buttons.
To add a button at the end of the row regardless of where the inherited view positions things, use a second xpath:
@@ -1204,8 +1206,8 @@ Each model gets `tag_ids`, `reason_id`, `team_id`. NCR + RMA additionally get `s
- `fp.job.step.button_finish`: trigger `job_step_done` points.
### Phase D — Integration polish (~1 day)
1. **`fp.job` form smart-button row**: add `Holds`, `Checks`, `NCRs`, `CAPAs`, `RMAs` buttons with badge counts. Always-visible (zero is OK).
2. **`sale.order` form smart-button row**: same five, rolled up across all linked jobs.
1. **`fp.job` form smart-button row**: add `Holds`, `Checks`, `NCRs`, `CAPAs`, `RMAs` buttons with badge counts. ~~Always-visible (zero is OK).~~ **Superseded 2026-06-04 — now hide-at-zero + order/job-scoped NCR/CAPA counts; see the Smart Buttons "Conditional visibility" note above.**
2. **`sale.order` form smart-button row**: same five, rolled up across all linked jobs. (Also hide-at-zero as of 2026-06-04.)
3. **`res.partner` form**: customer-level "Quality History" smart button that opens a kanban filtered to that partner across all 5 record types.
4. **One-click cross-creation**:
- Hold form → `Open NCR` button — pre-fills NCR with hold's part / customer / quantity / linked job.