chore(plating): de-dash fusion_plating_iot too
Same em-dash -> hyphen sweep applied to fusion_plating_iot (lives under fusion_iot/ so the main commit missed it). Comments/strings only; no functional dashes in this module. Keeps git in sync with the in-place de-dash already applied to entech. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"""Time-series of sensor readings.
|
||||
|
||||
Every POST to /fp/iot/ingest (or every broadcast from the iot proxy)
|
||||
lands as a new row here. Kept intentionally append-only — we never
|
||||
lands as a new row here. Kept intentionally append-only - we never
|
||||
update or delete readings, which makes this the compliance log for
|
||||
bath-temperature history.
|
||||
|
||||
@@ -13,7 +13,7 @@ Auto-creates a fusion.plating.quality.hold when a reading falls
|
||||
outside the sensor's alert range AND the sensor has
|
||||
`alert_on_out_of_spec` enabled. The hold is created once per
|
||||
excursion (we don't spam a new hold for every reading during a
|
||||
sustained excursion) — tracked via the sensor's most-recent
|
||||
sustained excursion) - tracked via the sensor's most-recent
|
||||
`last_reading_in_spec` flag.
|
||||
"""
|
||||
|
||||
@@ -26,7 +26,7 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
class FpTankReading(models.Model):
|
||||
_name = 'fp.tank.reading'
|
||||
_description = 'Fusion Plating — Tank Sensor Reading'
|
||||
_description = 'Fusion Plating - Tank Sensor Reading'
|
||||
_order = 'reading_at desc, id desc'
|
||||
_rec_name = 'display_name'
|
||||
|
||||
@@ -34,7 +34,7 @@ class FpTankReading(models.Model):
|
||||
'fp.tank.sensor', string='Sensor', required=True,
|
||||
ondelete='cascade', index=True,
|
||||
)
|
||||
# Denormalised for fast list views + kpi queries — auto-filled at
|
||||
# Denormalised for fast list views + kpi queries - auto-filled at
|
||||
# create time from sensor_id. Indexed for historical trending.
|
||||
tank_id = fields.Many2one(
|
||||
'fusion.plating.tank', string='Tank',
|
||||
@@ -56,7 +56,7 @@ class FpTankReading(models.Model):
|
||||
value = fields.Float(
|
||||
string='Value (raw)', required=True, digits=(12, 4),
|
||||
help='Stored reading in the sensor\'s canonical unit (for '
|
||||
'temperature sensors this is always °C — the DS18B20 and '
|
||||
'temperature sensors this is always °C - the DS18B20 and '
|
||||
'every other temperature chip reports in Celsius natively; '
|
||||
'keeping storage canonical lets us switch display units '
|
||||
'per-company without re-migrating history).',
|
||||
@@ -66,7 +66,7 @@ class FpTankReading(models.Model):
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Display-aware fields — converted to the company's preferred unit
|
||||
# Display-aware fields - converted to the company's preferred unit
|
||||
# (res.company.x_fc_default_temp_uom = 'F' or 'C'). Only the list
|
||||
# and form views should show these; internal spec comparisons use
|
||||
# `value` so thresholds stay consistent across regions.
|
||||
@@ -84,7 +84,7 @@ class FpTankReading(models.Model):
|
||||
@api.depends('value', 'parameter_id', 'parameter_id.parameter_type',
|
||||
'parameter_id.uom')
|
||||
def _compute_display(self):
|
||||
# Read once per compute call — env.company rarely changes mid-batch.
|
||||
# Read once per compute call - env.company rarely changes mid-batch.
|
||||
pref = self.env.company.x_fc_default_temp_uom or 'C'
|
||||
for r in self:
|
||||
ptype = (r.parameter_id.parameter_type or '').lower()
|
||||
@@ -96,7 +96,7 @@ class FpTankReading(models.Model):
|
||||
r.display_unit = r.parameter_id.uom_display or ''
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Deviation from setpoint — signed Δ from the sensor's effective target
|
||||
# Deviation from setpoint - signed Δ from the sensor's effective target
|
||||
# in the company-preferred unit. Zero if no setpoint defined.
|
||||
# ------------------------------------------------------------------
|
||||
deviation_from_target = fields.Float(
|
||||
@@ -184,10 +184,10 @@ class FpTankReading(models.Model):
|
||||
for r in self:
|
||||
sensor = r.sensor_id.name or 'sensor'
|
||||
at = fields.Datetime.to_string(r.reading_at) if r.reading_at else ''
|
||||
r.display_name = f'{sensor} — {r.display_value:.2f} {r.display_unit} @ {at}'
|
||||
r.display_name = f'{sensor} - {r.display_value:.2f} {r.display_unit} @ {at}'
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Create hook — evaluate against spec + raise a quality hold if we
|
||||
# Create hook - evaluate against spec + raise a quality hold if we
|
||||
# just crossed INTO an out-of-spec state.
|
||||
# ------------------------------------------------------------------
|
||||
@api.model_create_multi
|
||||
@@ -197,7 +197,7 @@ class FpTankReading(models.Model):
|
||||
try:
|
||||
rec._evaluate_spec()
|
||||
except Exception:
|
||||
# Never let alert-logic break the ingest path — the
|
||||
# Never let alert-logic break the ingest path - the
|
||||
# reading itself is what matters for compliance. Log
|
||||
# and carry on.
|
||||
_logger.exception(
|
||||
@@ -256,7 +256,7 @@ class FpTankReading(models.Model):
|
||||
'hold_reason': 'out_of_spec',
|
||||
'description': description,
|
||||
'qty_on_hold': 1,
|
||||
# state defaults to 'on_hold' — leave it
|
||||
# state defaults to 'on_hold' - leave it
|
||||
}
|
||||
# Attach facility + work-centre context if the tank has them,
|
||||
# so the hold is actionable from the shop floor (operator can
|
||||
|
||||
Reference in New Issue
Block a user