Files
Odoo-Modules/fusion_iot/fusion_plating_iot/__manifest__.py
gsinghpal 089cda71fe fix(fusion_iot): respect company temperature-unit preference in sensor UI
The sensor readings list always showed raw °C regardless of the
Plating Settings Temperature Unit preference (res.company.x_fc_default_temp_uom).
On a Fahrenheit-preferred shop, a 40°C reading should render as 105°F.

Fix: add display-aware computed fields alongside the canonical ones.

**fp.tank.reading**
- `value` / `unit` renamed with "(raw)" labels — these are the stored
  canonical values (always °C for temperature, because every
  temperature chip reports in Celsius natively)
- `display_value` + `display_unit` computed from company pref — only
  flips C→F when parameter_type='temperature' AND company pref='F';
  pH/conductivity/etc pass through untouched
- `display_name` now uses display_value so it reads naturally
  ("Sensor — 105.58 °F @ ...") regardless of region

**fp.tank.sensor**
- Mirrored the same pattern on the cached last-reading fields
- `last_reading_display` + `last_reading_display_unit` for lists
- `last_reading_value` hidden behind group_no_one (debug-only)

**Views**
- fp.tank.reading list: show display_value/display_unit, raw value
  hidden by default (toggle from column picker if needed)
- fp.tank.sensor list + form + tank inline: same pattern
- Raw value kept visible as an optional column so data engineers
  can still audit canonical storage

Why store canonical: spec thresholds (alert_min/max) live on the
sensor in °C. If the same Odoo serves a multi-region company
(Canada in C, US affiliate in F), switching a single preference
flips every UI without touching data. Alert logic keeps comparing
canonical values, so out-of-spec holds fire correctly regardless
of display unit.

Verified: 40.88°C raw → 105.58°F display on the live pilot probe
with company pref='F'. All 5 recent readings tested, display
fields updated correctly on every poll.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 16:13:17 -04:00

57 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
{
'name': 'Fusion Plating — IoT Integration',
'version': '19.0.0.2.0',
'category': 'Manufacturing/Plating',
'summary': 'Wire physical tank sensors to Fusion Plating — live '
'temperature / chemistry readings with auto quality holds '
'on out-of-spec.',
'description': """
Fusion Plating — IoT Integration
================================
Bridges the generic `iot` module (IoT Box + device management) to
plating-specific models:
* ``fp.tank.sensor`` — maps an ``iot.device`` to a
``fusion.plating.tank`` (or a ``fusion.plating.bath``).
* ``fp.tank.reading`` — time-series log of every sensor reading.
* Auto-creates a ``fusion.plating.quality.hold`` when a reading
falls outside the tank/bath's target range (per
``fusion.plating.bath.parameter`` spec).
Supports both the Odoo-IoT proxy path (Pi running iot_drivers) AND
a direct HTTP ingest path (``/fp/iot/ingest``) for sensors that
skip the proxy and POST straight to Odoo with a shared secret.
Part of the Fusion Plating product family by Nexa Systems Inc.
""",
'author': 'Nexa Systems Inc.',
'website': 'https://www.nexasystems.ca',
'maintainer': 'Nexa Systems Inc.',
'support': 'support@nexasystems.ca',
'license': 'OPL-1',
'price': 0.00,
'currency': 'CAD',
'depends': [
'iot',
'fusion_plating',
'fusion_plating_quality',
],
'data': [
'security/ir.model.access.csv',
'data/ir_config_parameter_data.xml',
'views/fp_tank_sensor_views.xml',
'views/fp_tank_reading_views.xml',
'views/fusion_plating_tank_views.xml',
'views/fp_iot_menu.xml',
],
'installable': True,
'application': False,
'auto_install': False,
}