From 7d71b77e14f1eac3cdc20c672ffb4e7eb314b5c9 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sat, 25 Apr 2026 09:19:03 -0400 Subject: [PATCH] fix(jobs): map fp.coating.config.thickness_uom to fp.job.step.thickness_uom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recipe→steps generator was copying coating.thickness_uom blind into fp.job.step.thickness_uom, but the two selections use different value codes: fp.coating.config.thickness_uom : 'mils' / 'microns' / 'inches' fp.job.step.thickness_uom : 'mil' / 'um' / 'inch' Result: any SO confirmed with a coating using the long-form codes (real demo data uses 'mils') hit a 'Wrong value for ...' selection error, the savepoint rolled back, and the fp.job ended up with 0 steps. Add an explicit mapping. Unknown values fall through to the step default ('um'). Demo seed re-run after the fix produces 234 steps across 31 jobs (was 207); thickness_uom distribution: 228 um, 6 mil. Part of: native job model migration (spec 2026-04-25) Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_jobs/models/fp_job.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fusion_plating/fusion_plating_jobs/models/fp_job.py b/fusion_plating/fusion_plating_jobs/models/fp_job.py index 0b2fb519..dcb1aa93 100644 --- a/fusion_plating/fusion_plating_jobs/models/fp_job.py +++ b/fusion_plating/fusion_plating_jobs/models/fp_job.py @@ -224,7 +224,24 @@ class FpJob(models.Model): 'thickness_uom' in coating._fields and coating.thickness_uom ): - vals['thickness_uom'] = coating.thickness_uom + # fp.coating.config uses long-form uom names + # (mils / microns / inches); fp.job.step uses + # short codes (mil / um / inch). Map between + # them. Unknown values fall through to the + # step's default ('um'). + _UOM_MAP = { + 'mils': 'mil', + 'mil': 'mil', + 'microns': 'um', + 'micron': 'um', + 'um': 'um', + 'inches': 'inch', + 'inch': 'inch', + 'in': 'inch', + } + mapped = _UOM_MAP.get(coating.thickness_uom) + if mapped: + vals['thickness_uom'] = mapped step_vals_list.append(vals) if instructions: