Phase A of the IoT initiative — gets the server-side infrastructure
in place before the Raspberry Pi hardware arrives, so the iot admin
UI + /fp/iot/ingest endpoint are ready to accept the first real
temperature reading as soon as the Pi is wired up.
New top-level folder: fusion_iot/
1. **iot_base/** — Odoo S.A. iot_base module, copied from
RePackaged-Odoo verbatim. LGPL-3 upstream, no changes needed.
2. **iot/** — Odoo S.A. iot module, repackaged:
- `models/update.py` neutralised (removed the publisher_warranty
IoT-Box-counting report that phones home to odoo.com for
enterprise licence enforcement)
- `iot_handlers/lib/load_worldline_library.sh` deleted (proprietary
Worldline payment lib fetch from download.odoo.com, not needed)
- `wizard/add_iot_box.py._connect_iot_box_with_pairing_code` —
upstream called odoo.com's iot-proxy to resolve pairing codes;
replaced with a no-op. Pi-side iot_drivers proxy registers
directly with this Odoo server instead.
- Manifest rebranded with an explicit changelog preamble.
3. **fusion_plating_iot/** — new plating-specific wrapper:
- `fp.tank.sensor` — maps an iot.device (or a direct-HTTP-ingest
sensor) to a fusion.plating.tank + fusion.plating.bath.parameter.
Supports DS18B20, PT100/1000, pH, conductivity, level. Per-sensor
alert_min/max overrides.
- `fp.tank.reading` — append-only time-series. On create, evaluates
against sensor's alert range. On in-spec → out-of-spec TRANSITION,
auto-raises a fusion.plating.quality.hold (once per excursion,
no spam during sustained out-of-spec).
- `POST /fp/iot/ingest` — shared-secret HTTP endpoint for sensors
bypassing the Pi proxy. Token via X-FP-IOT-Token header OR body.
Accepts single-reading or batch payloads.
- Menu under Plating → Operations → Sensors & Readings.
- Tank form inherits get a Sensors tab inline.
Deployed to entech. Verified end-to-end:
- Install: iot_base + iot + fusion_plating_iot all 'installed'
- Smoke test: in-spec → out-of-spec → hold raised (HOLD-0010);
continued excursion → NO duplicate hold; back-in-spec → NEW
excursion → NEW hold (HOLD-0011) ✓
- HTTP endpoint: correct token → 200 accepted; wrong token → 401;
unknown device_serial → 404; batch payload → 200 accepted=N ✓
Phase B (when Raspberry Pi hardware arrives): DS18B20 iot_handler
driver for the Pi-side iot_drivers proxy + systemd service on
vanilla Raspberry Pi OS + first live reading from physical probe.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
296 lines
14 KiB
XML
296 lines
14 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Menus -->
|
|
<menuitem
|
|
id="iot_menu_root"
|
|
name="IoT"
|
|
web_icon="iot,static/description/icon.png"
|
|
groups="iot.group_iot_user"
|
|
sequence="265"
|
|
/>
|
|
|
|
<!-- Client Actions -->
|
|
<record id="action_iot_delete_linked_devices_menu" model="ir.actions.client">
|
|
<field name="name">reset.linked.printers</field>
|
|
<field name="tag">iot_delete_linked_devices_action</field>
|
|
</record>
|
|
<record id="action_discover_iot_boxes" model="ir.actions.client">
|
|
<field name="name">Discover IoT boxes</field>
|
|
<field name="tag">discover_iot_boxes</field>
|
|
</record>
|
|
|
|
<!-- IoT Boxes -->
|
|
<record id="iot_box_view_form" model="ir.ui.view">
|
|
<field name="name">iot.box.view.form</field>
|
|
<field name="model">iot.box</field>
|
|
<field name="arch" type="xml">
|
|
<form create="false">
|
|
<header>
|
|
<widget name="test_iot_box" btn_name="Test" btn_class="primary" invisible="not version or 'W' in version"/>
|
|
<button name="open_homepage" type="object" string="Homepage" class="btn btn-secondary"/>
|
|
<t groups="base.group_no_one">
|
|
<widget name="iot_download_logs" btn_name="Download Logs" btn_class="secondary"/>
|
|
<widget name="iot_restart_odoo" btn_name="Restart Odoo" btn_class="secondary"/>
|
|
<widget groups="iot.group_iot_admin" name="iot_reset_password" btn_name="Reset Password" btn_class="secondary" invisible="not version or 'W' in version"/>
|
|
<widget groups="iot.group_iot_admin" name="iot_remote_debug" btn_name="Remote Debug" btn_class="secondary" invisible="not version or 'W' in version"/>
|
|
</t>
|
|
</header>
|
|
<sheet>
|
|
<div class="alert alert-warning d-flex align-items-center" role="alert" invisible="not must_install_fdm_module">
|
|
<span>
|
|
A fiscal data module has been connected. To use it,
|
|
<a class="alert-link text-decoration-underline" type="object" name="install_fdm_module">install the Fiscal Data Module</a>
|
|
app.
|
|
</span>
|
|
</div>
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name"/>
|
|
</h1>
|
|
</div>
|
|
<group>
|
|
<group>
|
|
<field name="identifier" readonly="True"/>
|
|
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" placeholder="Visible to all"/>
|
|
</group>
|
|
</group>
|
|
<notebook>
|
|
<page string="Devices" name="devices">
|
|
<field name="device_ids" readonly="False" widget="device_list_field">
|
|
<list default_order="connection, name">
|
|
<field name="name"/>
|
|
<field name="identifier"/>
|
|
<field name="type"/>
|
|
<field name="connection"/>
|
|
<field name="connected_status" string="Status"/>
|
|
</list>
|
|
</field>
|
|
</page>
|
|
<page string="Technical Information" groups="base.group_no_one">
|
|
<group>
|
|
<field name="ip"/>
|
|
<field name="version_commit_url" string="Image Version"/>
|
|
<field name="drivers_auto_update"/>
|
|
<field name="ssl_certificate_end_date" invisible="not ssl_certificate_end_date"/>
|
|
</group>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
<record id="iot_box_view_kanban" model="ir.ui.view">
|
|
<field name="name">iot.box.view.kanban</field>
|
|
<field name="model">iot.box</field>
|
|
<field name="arch" type="xml">
|
|
<kanban create="false">
|
|
<header>
|
|
<button groups="iot.group_iot_admin" name="iot.action_discover_iot_boxes" type="action" string="Connect" class="btn-primary o-kanban-button-new" display="always"/>
|
|
</header>
|
|
<templates>
|
|
<t t-name="card" class="p-0">
|
|
<div id="card" class="p-3 d-flex flex-column justify-content-between">
|
|
<div class="text-truncate fw-bold d-flex align-items-center justify-content-between" t-att-title="record.name.raw_value">
|
|
<field name="name"/>
|
|
<span class="float-end"><field name="device_count"/> <i t-attf-class="fa fa-plug" title="device-icon"/></span>
|
|
</div>
|
|
<field class="fs-6 pb-2" name="create_date" widget="datetime" options="{'show_time': false}"/>
|
|
</div>
|
|
</t>
|
|
</templates>
|
|
</kanban>
|
|
</field>
|
|
</record>
|
|
<record id="iot_box_view_list" model="ir.ui.view">
|
|
<field name="name">iot.box.view.list</field>
|
|
<field name="model">iot.box</field>
|
|
<field name="arch" type="xml">
|
|
<list create="false">
|
|
<header>
|
|
<button groups="iot.group_iot_admin" name="iot.action_discover_iot_boxes" type="action" string="Connect" class="btn-primary" display="always"/>
|
|
</header>
|
|
<field name="name"/>
|
|
<field name="identifier"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
<record id="iot_box_action" model="ir.actions.act_window">
|
|
<field name="name">IoT Boxes</field>
|
|
<field name="path">iot</field>
|
|
<field name="res_model">iot.box</field>
|
|
<field name="view_mode">kanban,list,form</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
No IoT Box found!
|
|
</p><p>
|
|
Click on the
|
|
<a name="connect_iot_box" type="object" tabindex="-1">connect</a>
|
|
to add an IoT Box.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- IoT Devices -->
|
|
<record id="iot_device_view_form" model="ir.ui.view">
|
|
<field name="name">iot.device.view.form</field>
|
|
<field name="model">iot.device</field>
|
|
<field name="arch" type="xml">
|
|
<form create="false" js_class="iot_device_form">
|
|
<header>
|
|
<button name="test_device" string="Test" class="btn btn-primary" invisible="type not in ['printer', 'fiscal_data_module']"/>
|
|
<field name="connected_status" widget="statusbar"/>
|
|
</header>
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name"/>
|
|
</h1>
|
|
</div>
|
|
<group name="iot_device_details">
|
|
<group>
|
|
<field name="iot_id" readonly="True"/>
|
|
<field name="identifier" readonly="True"/>
|
|
<field name="connection"/>
|
|
<field name="is_scanner" invisible="type not in ['keyboard', 'scanner']" widget="boolean_toggle"/>
|
|
<field name="manufacturer" invisible="manufacturer == ''"/>
|
|
<field name="keyboard_layout" invisible="type not in ['keyboard', 'scanner']"/>
|
|
<field name="display_url" invisible="type != 'display'"/>
|
|
</group>
|
|
<group>
|
|
<field name="type"/>
|
|
<field name="subtype" invisible= "type != 'printer'"/>
|
|
</group>
|
|
</group>
|
|
<notebook>
|
|
<page string="Reports to Auto-Print" name="reports" invisible="type != 'printer'">
|
|
<field name="report_ids" widget="many2many" context="{'list_view_ref': 'iot.act_report_xml_view_tree_iot'}"/>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
<record id="iot_device_view_kanban" model="ir.ui.view">
|
|
<field name="name">iot.device.view.kanban</field>
|
|
<field name="model">iot.device</field>
|
|
<field name="arch" type="xml">
|
|
<kanban create="false" group_create="false" sample="1" default_group_by="iot_id" default_order="type">
|
|
<field name="type"/>
|
|
<field name="connection"/>
|
|
<field name="connected_status"/>
|
|
<templates>
|
|
<t t-name="card" class="row g-0 p-0">
|
|
<aside class="col-3 text-center align-self-center">
|
|
<t t-set="types" t-value="{'camera': 'camera', 'printer': 'printer', 'device': 'rulers', 'payment': 'payment-terminal', 'scale': 'scales', 'keyboard': 'keyboard', 'scanner': 'barcode-scanner', 'display': 'desktop', 'fiscal_data_module': 'fdm', 'unsupported': 'unsupported'}"/>
|
|
<img t-attf-src="/iot/static/src/img/#{types[record.type.raw_value]}.svg" t-attf-alt="Device type is #{record.type.raw_value}" class="w-50"/>
|
|
</aside>
|
|
<main class="col p-2 border-start">
|
|
<div class="text-truncate fw-bold d-flex align-items-center justify-content-between" t-att-title="record.name.raw_value">
|
|
<field name="name" class="text-truncate"/>
|
|
<i class="fa fa-circle text-success" t-if="record.connected_status.raw_value == 'connected'"/>
|
|
<i class="fa fa-circle text-danger" t-else=""/>
|
|
</div>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<t t-set="connections" t-value="{'network': 'wifi', 'direct': 'usb', 'bluetooth': 'bluetooth-b', 'serial': 'usb', 'hdmi': 'usb'}"/>
|
|
<i t-attf-class="fa fa-#{connections[record.connection.raw_value]} fa-fw" title="connection_type"/>
|
|
<field name="iot_id" class="text-truncate" readonly="1"/>
|
|
</div>
|
|
</main>
|
|
</t>
|
|
</templates>
|
|
</kanban>
|
|
</field>
|
|
</record>
|
|
<record id="iot_device_view_list" model="ir.ui.view">
|
|
<field name="name">iot.device.view.list</field>
|
|
<field name="model">iot.device</field>
|
|
<field name="arch" type="xml">
|
|
<list create="false" default_order="type">
|
|
<field name="name"/>
|
|
<field name="iot_id"/>
|
|
<field name="identifier"/>
|
|
<field name="connected_status"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
<record id="iot_device_search" model="ir.ui.view">
|
|
<field name="name">iot.device.view.search</field>
|
|
<field name="model">iot.device</field>
|
|
<field name="arch" type="xml">
|
|
<search string="IoT Device">
|
|
<field name="name"/>
|
|
<field name="type"/>
|
|
<field name="iot_id"/>
|
|
<group>
|
|
<filter name="group_by_connection" string="Connection" context="{'group_by':'connection'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
<record id="iot_device_action" model="ir.actions.act_window">
|
|
<field name="name">Devices</field>
|
|
<field name="res_model">iot.device</field>
|
|
<field name="view_mode">kanban,list,form</field>
|
|
<field name="context">{'search_default_group_by_iot_id': 1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_empty_folder">
|
|
There is no device connected to your IoT Boxes
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<menuitem
|
|
id="iot_box_menu_action"
|
|
action="iot_box_action"
|
|
parent="iot_menu_root"
|
|
sequence="1"/>
|
|
<menuitem
|
|
id="iot_device_menu_action"
|
|
action="iot_device_action"
|
|
parent="iot_menu_root"
|
|
sequence="2"/>
|
|
<menuitem
|
|
id="view_iot_selected_printer_local_action"
|
|
name="Configuration"
|
|
parent="iot_menu_root"
|
|
sequence="3"/>
|
|
|
|
<!-- Reporting submenu -->
|
|
<menuitem
|
|
id="iot_settings_menu_action"
|
|
name="Reporting"
|
|
parent="view_iot_selected_printer_local_action"
|
|
sequence="4"/>
|
|
<menuitem
|
|
id="iot_clear_selected_devices"
|
|
name="Reset Linked Printers"
|
|
sequence="5"
|
|
parent="iot_settings_menu_action"
|
|
action="action_iot_delete_linked_devices_menu"/>
|
|
|
|
<!-- ir.action.report add the device -->
|
|
<record id="act_report_xml_view_iot" model="ir.ui.view">
|
|
<field name="name">ir.actions.report.iot</field>
|
|
<field name="model">ir.actions.report</field>
|
|
<field name="inherit_id" ref="base.act_report_xml_view"/>
|
|
<field name="arch" type="xml">
|
|
<field name="report_type" position="after">
|
|
<field name="device_ids" widget="many2many_tags"/>
|
|
</field>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="act_report_xml_view_tree_iot" model="ir.ui.view">
|
|
<field name="name">ir.actions.report.list.iot</field>
|
|
<field name="model">ir.actions.report</field>
|
|
<field name="priority">100</field>
|
|
<field name="arch" type="xml">
|
|
<list string="Report xml">
|
|
<field name="name"/>
|
|
<field name="model"/>
|
|
<field name="report_type"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
</odoo>
|