Files
odoo_source/addons/iot/views/iot_views.xml
T
Josse Colpaert 92172d0229 [ADD] iot: basic models + controllers server-side, print reports, measure widget
When an IoT box is configured as IoT box, it will
send all the information about itself and its devices
to its server.  This way the server knows which ip and which
devices are on the iotbox.  Reports and in the enterprise
version quality points will be linked to devices.
In the module iot, the models and the controller are defined for this.

There is also a javascript part with a widget for taking
a measure and the possibility to link any report with a printer device.
2018-08-22 16:54:57 +02:00

189 lines
7.1 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="base.group_system"
/>
<!-- 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">
<sheet>
<div class="oe_title">
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group>
<field name="identifier" readonly="True"/>
<field name="ip"/>
<field name="screen_url"/>
</group>
</group>
<notebook>
<page string="Devices">
<field name="device_ids">
<tree>
<field name="name"/>
<field name="type"/>
<field name="identifier"/>
</tree>
</field>
</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">
<field name="name"/>
<field name="identifier"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_record_top mb0">
<strong class="o_kanban_record_title"><field name="name"/></strong>
</div>
</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">
<tree create="false">
<field name="name"/>
<field name="identifier"/>
</tree>
</field>
</record>
<record id="iot_box_action" model="ir.actions.act_window">
<field name="name">Iot Boxes</field>
<field name="res_model">iot.box</field>
<field name="view_mode">kanban,list,form</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">
<sheet>
<div class="oe_title">
<h1>
<field name="name"/>
</h1>
</div>
<group name="iot_device_details">
<group>
<field name="iot_id" attrs="{'readonly': ['|', ('type', '!=', 'printer'), ('connection', '!=', 'network')]}"/>
<field name="identifier" readonly="True"/>
<field name="type"/>
<field name="connection"/>
</group>
</group>
<notebook>
<page string="Printer Reports" name="reports" attrs="{'invisible': [('type', '!=', 'printer')]}">
<field name="report_ids" widget="many2many"/>
</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">
<field name="name"/>
<field name="identifier"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_record_top mb0">
<strong class="o_kanban_record_title"><field name="name"/></strong>
</div>
<field name="iot_id"/>
</div>
</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">
<tree create="false">
<field name="name"/>
<field name="iot_id"/>
<field name="identifier"/>
</tree>
</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">
<group expand="0" string="Group By">
<filter name="group_by_type" string="Device type" context="{'group_by': 'type'}"/>
</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_type': 1}</field>
</record>
<menuitem
id="iot_device_menu_action"
action="iot_device_action"
parent="iot_menu_root"
sequence="1"/>
<menuitem
id="iot_box_menu_action"
action="iot_box_action"
parent="iot_menu_root"
sequence="2"/>
<!-- 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_id"/>
</field>
</field>
</record>
<!-- JS assets -->
<template id="assets_backend" inherit_id="web.assets_backend" name="IoT assets">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/iot/static/src/css/iot.css"/>
<script type="text/javascript" src="/iot/static/src/js/iot.js"></script>
</xpath>
</template>
</odoo>