feat(plating): wire deferred UoM defaults — bake oven, bake window, coating, tank
Follow-up to the company-level UoM defaults commit. Wires four more
unit-bearing fields to inherit from res.company defaults at create-time.
**1. fp.bake.oven**
• New `target_temp_uom` (°F / °C) — defaults from
company.x_fc_default_temp_uom.
• View: target_temp_min / max now render with a unit picker on the
same row instead of unitless floats. Rule of thumb: "350–380 °F".
**2. fp.bake.window**
• New `bake_temp_uom` — defaults from company.x_fc_default_temp_uom.
• View: replaced hardcoded `°F` span with a live unit picker so the
label matches whatever unit was actually recorded.
**3. fp.coating.config**
• New `bake_temperature_uom` — defaults from company.
• Removed hardcoded "Bake Temperature (°F)" label; the field is
now unit-agnostic and the unit travels with the value.
**4. fp.tank.volume_uom**
• Default now derives from company.x_fc_default_volume_uom via a
small mapping (gal → gal_us, L → l, imp_gal → gal_imp). The
selection itself stays the same — tanks already supported all
common volume units; we just pre-pick the right one per company.
**Verified end-to-end** (scripts/fp_uom_smoke2.py):
• Switching company default to °C + Litres
• New oven gets C ✓
• New bake window gets C ✓
• New coating config gets C ✓
• New tank gets `l` ✓ (mapped from company `L`)
• Restored defaults afterwards
Existing records keep their stored uom — no surprise mutation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,13 @@ class FpBakeOven(models.Model):
|
||||
string='Target Temp Max',
|
||||
help='Upper bound of target oven temperature.',
|
||||
)
|
||||
target_temp_uom = fields.Selection(
|
||||
[('F', '°F'), ('C', '°C')],
|
||||
string='Temp Unit',
|
||||
default=lambda self: self.env.company.x_fc_default_temp_uom or 'F',
|
||||
help='Unit for the target temp range. Defaults to the company '
|
||||
'preference (Settings → Fusion Plating → Units of Measure).',
|
||||
)
|
||||
chart_recorder_ref = fields.Char(
|
||||
string='Chart Recorder Ref',
|
||||
help='Serial / asset reference of the chart recorder providing trace evidence.',
|
||||
|
||||
@@ -110,6 +110,13 @@ class FpBakeWindow(models.Model):
|
||||
)
|
||||
bake_temp = fields.Float(
|
||||
string='Bake Temp',
|
||||
help='Setpoint temperature recorded for the relief bake. '
|
||||
'Unit follows bake_temp_uom (defaults from company).',
|
||||
)
|
||||
bake_temp_uom = fields.Selection(
|
||||
[('F', '°F'), ('C', '°C')],
|
||||
string='Temp Unit',
|
||||
default=lambda self: self.env.company.x_fc_default_temp_uom or 'F',
|
||||
)
|
||||
bake_duration_hours = fields.Float(
|
||||
string='Bake Duration (hours)',
|
||||
|
||||
Reference in New Issue
Block a user