fix(jobs): map fp.coating.config.thickness_uom to fp.job.step.thickness_uom
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user