Skip to content

Commit 358b883

Browse files
committed
[FIX/IMP] iot_oca: fix and modernize kanban view for Odoo 18.0
- Fixed kanban colorpicker and global click crash using v18-compatible patterns - Modernized kanban card layout with a clean vertical structure - Re-added original fields (IP, Last Contact) and icons logic - Applied OCA pre-commit formatting standards
1 parent daee376 commit 358b883

4 files changed

Lines changed: 119 additions & 96 deletions

File tree

iot_oca/README.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
========
62
IoT Base
73
========
@@ -17,7 +13,7 @@ IoT Base
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fiot-lightgray.png?logo=github
@@ -60,8 +56,9 @@ Authors
6056
Contributors
6157
------------
6258

63-
- Enric Tobella <etobella@creublanca.es>
64-
- ViraWeb123 <info@viraweb123.ir>
59+
- Enric Tobella etobella@creublanca.es
60+
- ViraWeb123 info@viraweb123.ir
61+
- Ghostdev9410 riccardoluzi52@gmail.com
6562

6663
Maintainers
6764
-----------

iot_oca/readme/CONTRIBUTORS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
- Enric Tobella \<<etobella@creublanca.es>\>
2-
- ViraWeb123 \<<info@viraweb123.ir>\>
1+
- Enric Tobella <etobella@creublanca.es>
2+
- ViraWeb123 <info@viraweb123.ir>
3+
- Ghostdev9410 <riccardoluzi52@gmail.com>

iot_oca/static/description/index.html

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>IoT Base</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="iot-base">
364+
<h1 class="title">IoT Base</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="iot-base">
370-
<h1>IoT Base</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:889ef99592819ed5b23b313ad174361e1a470b2db47d14f0908c41c7e61bf746
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/iot/tree/18.0/iot_oca"><img alt="OCA/iot" src="https://img.shields.io/badge/github-OCA%2Fiot-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/iot-18-0/iot-18-0-iot_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/iot&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/iot/tree/18.0/iot_oca"><img alt="OCA/iot" src="https://img.shields.io/badge/github-OCA%2Fiot-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/iot-18-0/iot-18-0-iot_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/iot&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>This addon is a base module used for all iot modules.</p>
379374
<p><strong>Table of contents</strong></p>
380375
<div class="contents local topic" id="contents">
@@ -389,30 +384,31 @@ <h1>IoT Base</h1>
389384
</ul>
390385
</div>
391386
<div class="section" id="bug-tracker">
392-
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
387+
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
393388
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/iot/issues">GitHub Issues</a>.
394389
In case of trouble, please check there if your issue has already been reported.
395390
If you spotted it first, help us to smash it by providing a detailed and welcomed
396391
<a class="reference external" href="https://github.com/OCA/iot/issues/new?body=module:%20iot_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
397392
<p>Do not contact contributors directly about support or help with technical issues.</p>
398393
</div>
399394
<div class="section" id="credits">
400-
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
395+
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
401396
<div class="section" id="authors">
402-
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
397+
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
403398
<ul class="simple">
404399
<li>Creu Blanca</li>
405400
</ul>
406401
</div>
407402
<div class="section" id="contributors">
408-
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
403+
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
409404
<ul class="simple">
410-
<li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li>
411-
<li>ViraWeb123 &lt;<a class="reference external" href="mailto:info&#64;viraweb123.ir">info&#64;viraweb123.ir</a>&gt;</li>
405+
<li>Enric Tobella <a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a></li>
406+
<li>ViraWeb123 <a class="reference external" href="mailto:info&#64;viraweb123.ir">info&#64;viraweb123.ir</a></li>
407+
<li>Ghostdev9410 <a class="reference external" href="mailto:riccardoluzi52&#64;gmail.com">riccardoluzi52&#64;gmail.com</a></li>
412408
</ul>
413409
</div>
414410
<div class="section" id="maintainers">
415-
<h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
411+
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
416412
<p>This module is maintained by the OCA.</p>
417413
<a class="reference external image-reference" href="https://odoo-community.org">
418414
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -425,6 +421,5 @@ <h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
425421
</div>
426422
</div>
427423
</div>
428-
</div>
429424
</body>
430425
</html>

iot_oca/views/iot_device_views.xml

Lines changed: 100 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<field name="name">iot.device.kanban</field>
9494
<field name="model">iot.device</field>
9595
<field name="arch" type="xml">
96-
<kanban class="o_kanban_dashboard">
96+
<kanban class="o_kanban_dashboard" delete="1">
9797
<field name="name" />
9898
<field name="state" />
9999
<field name="communication_system_id" />
@@ -102,94 +102,124 @@
102102
<field name="id" />
103103
<field name="image_128" />
104104
<field name="icon" />
105+
<field name="tag_ids" />
106+
<field name="last_contact_date" />
105107
<templates>
106-
<t t-name="card">
108+
<t t-name="kanban-box">
107109
<div
108-
t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_global_click"
110+
t-attf-class="oe_kanban_global_click o_kanban_record #{kanban_color(record.color.raw_value)} d-flex flex-column p-3"
109111
>
110-
<div class="o_dropdown_kanban dropdown">
111-
<a
112-
role="button"
113-
class="dropdown-toggle o-no-caret btn"
114-
data-toggle="dropdown"
115-
data-display="static"
116-
href="#"
117-
aria-label="Dropdown menu"
118-
title="Dropdown menu"
119-
>
120-
<span class="fa fa-ellipsis-v" />
121-
</a>
122-
<div class="dropdown-menu" role="menu">
123-
<t t-if="widget.editable">
112+
<div
113+
class="o_kanban_record_top d-flex justify-content-between align-items-center mb-2"
114+
>
115+
<div class="o_kanban_record_headings overflow-hidden">
116+
<strong
117+
class="o_kanban_record_title fs-5 text-truncate d-block mb-0"
118+
>
119+
<field name="name" />
120+
</strong>
121+
</div>
122+
<div class="o_dropdown_kanban dropdown px-0">
123+
<a
124+
class="dropdown-toggle o-no-caret btn btn-sm text-muted opacity-75 opacity-100-hover"
125+
data-bs-toggle="dropdown"
126+
href="#"
127+
role="button"
128+
title="Menu"
129+
>
130+
<i class="fa fa-ellipsis-v fa-lg" />
131+
</a>
132+
<div class="dropdown-menu shadow-sm" role="menu">
124133
<a
125134
role="menuitem"
126135
type="edit"
127136
class="dropdown-item"
128-
>Edit...</a>
129-
</t>
130-
<t t-if="widget.deletable">
137+
>Edit</a>
131138
<a
132139
role="menuitem"
133140
type="delete"
134141
class="dropdown-item"
135142
>Delete</a>
136-
</t>
137-
<ul
138-
class="oe_kanban_colorpicker"
139-
data-field="color"
143+
<div
144+
role="separator"
145+
class="dropdown-divider"
146+
/>
147+
<ul
148+
class="oe_kanban_colorpicker"
149+
data-field="color"
150+
/>
151+
</div>
152+
</div>
153+
</div>
154+
<div class="o_kanban_record_body flex-grow-1">
155+
<div
156+
t-if="record.group_id.raw_value"
157+
class="text-muted small mb-1"
158+
>
159+
<i class="fa fa-folder-open-o me-1" />
160+
<field name="group_id" />
161+
</div>
162+
<div
163+
t-if="record.ip.raw_value"
164+
class="text-primary small fw-bold mb-1"
165+
>
166+
<i class="fa fa-plug me-1" />
167+
IP: <field name="ip" />
168+
</div>
169+
<div
170+
t-if="record.last_contact_date.raw_value"
171+
class="text-muted small mb-2"
172+
>
173+
<i class="fa fa-clock-o me-1" />
174+
Last contact: <field name="last_contact_date" />
175+
</div>
176+
<div class="o_kanban_tags_section mt-2">
177+
<field
178+
name="tag_ids"
179+
widget="many2many_tags"
180+
options="{'color_field': 'color'}"
140181
/>
141182
</div>
142183
</div>
143-
<div class="oe_kanban_content">
144-
<div class="o_kanban_image">
184+
<div
185+
class="o_kanban_record_bottom d-flex justify-content-between align-items-center mt-3 pt-2 border-top border-light"
186+
>
187+
<div
188+
class="oe_kanban_bottom_left d-flex align-items-center"
189+
>
190+
<field
191+
name="state"
192+
widget="label_selection"
193+
options="{'classes': {'connected': 'success', 'error': 'danger'}}"
194+
/>
195+
</div>
196+
<div
197+
class="oe_kanban_bottom_right d-flex align-items-center text-truncate"
198+
>
199+
<span
200+
class="badge rounded-pill bg-light border text-muted px-2 py-1 me-2 shadow-sm"
201+
t-if="record.communication_system_id.raw_value"
202+
>
203+
<field name="communication_system_id" />
204+
</span>
145205
<img
146-
t-att-src="kanban_image('iot.device', 'image_128', record.id.raw_value)"
147-
alt="default_image"
148206
t-if="record.image_128.raw_value"
207+
t-attf-src="/web/image/iot.device/#{record.id.raw_value}/image_128"
208+
class="o_avatar rounded border bg-white"
209+
style="width: 26px; height: 26px;"
210+
alt="Device"
149211
/>
150-
<i
151-
t-attf-class="{{record.icon.raw_value}}"
152-
t-if="!record.image_128.raw_value and record.icon.raw_value"
153-
/>
154-
<i
155-
t-attf-class="fa fa-question fa-6x"
156-
title="Unknown device"
157-
t-if="!record.image_128.raw_value and !record.icon.raw_value"
158-
/>
159-
</div>
160-
<div class="o_kanban_details">
161-
<div class="o_kanban_record_top">
162-
<b class="o_kanban_record_title">
163-
<field name="name" />
164-
</b>
165-
</div>
166-
<div class="o_kanban_record_body">
167-
<div t-if="record.group_id.raw_value">
168-
<field name="group_id" />
169-
</div>
170-
<div t-if="record.ip">IP: <field
171-
name="ip"
172-
/></div>
173-
<div
174-
t-if="record.last_contact_date"
175-
>Last contact: <field
176-
name="last_contact_date"
177-
/></div>
178-
<field
179-
name="tag_ids"
180-
widget="many2many_tags"
181-
options="{'color_field': 'color'}"
212+
<t t-else="">
213+
<i
214+
t-if="record.icon.raw_value"
215+
t-attf-class="{{record.icon.raw_value}} text-muted fs-5"
182216
/>
183-
<div class="row">
184-
<div
185-
class="col-xs-6 o_kanban_primary_left"
186-
id="actions"
187-
>
188-
<!-- TODO: Delete this on 14, actions should go to dropdown menu -->
189-
</div>
190-
</div>
191-
</div>
192-
<div class="o_kanban_record_bottom" />
217+
<i
218+
t-else=""
219+
class="fa fa-question text-muted fs-5"
220+
title="Unknown device"
221+
/>
222+
</t>
193223
</div>
194224
</div>
195225
</div>

0 commit comments

Comments
 (0)