feat(fusion_plating_jobs): fp.job.display_wo_name compute (WO # 00001)
Plan task P1.1. Formats fp.job.name as "WO # <last-segment>" for tablet/dashboard surfaces. Underlying name field is unchanged so back-office forms, reports, and emails keep WH/JOB/00001. Tests not run locally — fusion_plating not mounted in odoo-modsdev container. Verify on entech: -u fusion_plating_jobs --test-tags fp_jobs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -97,6 +97,30 @@ class FpJob(models.Model):
|
||||
'idempotency. Cleared post-cutover.',
|
||||
)
|
||||
|
||||
# Display formatter — "WO # 00001" used everywhere on tablet/dashboard.
|
||||
# The underlying `name` field stays untouched (WH/JOB/00001) so reports,
|
||||
# emails, and back-office forms continue using their canonical name.
|
||||
# System-wide sequence rename is a separate decision (see spec
|
||||
# 2026-05-22-shopfloor-tablet-redesign-design §6.5).
|
||||
display_wo_name = fields.Char(
|
||||
compute='_compute_display_wo_name',
|
||||
string='WO #',
|
||||
help='Tablet/dashboard formatter — "WO # 00001" derived from name. '
|
||||
'Underlying name field is unchanged.',
|
||||
)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_display_wo_name(self):
|
||||
for job in self:
|
||||
raw = (job.name or '').strip()
|
||||
if not raw:
|
||||
job.display_wo_name = ''
|
||||
continue
|
||||
# Take the last "/"-separated segment as the number portion.
|
||||
# WH/JOB/00001 → 00001 ; WH/JOB/2026/00042 → 00042 ; 00123 → 00123
|
||||
tail = raw.rsplit('/', 1)[-1]
|
||||
job.display_wo_name = f'WO # {tail}'
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Sub 14 — Configurable workflow state (status bar milestone)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user