diff --git a/repair_views_kanban/README.rst b/repair_views_kanban/README.rst new file mode 100644 index 00000000..5744744e --- /dev/null +++ b/repair_views_kanban/README.rst @@ -0,0 +1,85 @@ +=================== +Repair Views Kanban +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b7dfc3e8e318a3b562f418159422d0608561871788f5435c5f22e33f59b414f9 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frepair-lightgray.png?logo=github + :target: https://github.com/OCA/repair/tree/16.0/repair_views_kanban + :alt: OCA/repair +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_views_kanban + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/repair&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides mobile-optimized kanban views for repair orders, designed to improve usability on mobile devices and tablets. + +Key Features: +- **Mobile-First Kanban Views**: Invoice-style kanban cards for repair parts (repair.line) and operations (repair.fee) +- **Type-Based Visual Indicators**: Color-coded icons showing add/remove operations with FontAwesome icons +- **Responsive Design**: Optimized layout for mobile devices (viewport ≤ 768px) +- **Touch-Friendly Interface**: Large touch targets and improved spacing for mobile interaction +- **Dual View Mode**: Seamless switching between tree and kanban views in repair order forms +- **Visual Status Indicators**: Clear display of invoiced status and operation types + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Binhex + +Contributors +~~~~~~~~~~~~ + +* Binhex + - Antonio Ruban + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/repair `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/repair_views_kanban/__init__.py b/repair_views_kanban/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/repair_views_kanban/__manifest__.py b/repair_views_kanban/__manifest__.py new file mode 100644 index 00000000..6ab58d45 --- /dev/null +++ b/repair_views_kanban/__manifest__.py @@ -0,0 +1,20 @@ +{ + "name": "Repair Views Kanban", + "version": "16.0.1.0.0", + "license": "LGPL-3", + "category": "Repair", + "summary": "Mobile-optimized kanban views for repair orders", + "author": "Binhex, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/repair", + "depends": ["repair"], + "data": [ + "views/repair_views_kanban.xml", + ], + "assets": { + "web.assets_backend": [ + "repair_views_kanban/static/src/js/list_renderer_mobile.js", + ], + }, + "installable": True, + "application": False, +} diff --git a/repair_views_kanban/readme/CONTRIBUTORS.rst b/repair_views_kanban/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..3b692969 --- /dev/null +++ b/repair_views_kanban/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Binhex + - Antonio Ruban \ No newline at end of file diff --git a/repair_views_kanban/readme/DESCRIPTION.rst b/repair_views_kanban/readme/DESCRIPTION.rst new file mode 100644 index 00000000..a106e4f6 --- /dev/null +++ b/repair_views_kanban/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +This module provides mobile-optimized kanban views for repair orders, designed to improve usability on mobile devices and tablets. + +Key Features: +- **Mobile-First Kanban Views**: Invoice-style kanban cards for repair parts (repair.line) and operations (repair.fee) +- **Type-Based Visual Indicators**: Color-coded icons showing add/remove operations with FontAwesome icons +- **Responsive Design**: Optimized layout for mobile devices (viewport ≤ 768px) +- **Touch-Friendly Interface**: Large touch targets and improved spacing for mobile interaction +- **Dual View Mode**: Seamless switching between tree and kanban views in repair order forms +- **Visual Status Indicators**: Clear display of invoiced status and operation types diff --git a/repair_views_kanban/static/description/icon.png b/repair_views_kanban/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/repair_views_kanban/static/description/icon.png differ diff --git a/repair_views_kanban/static/description/index.html b/repair_views_kanban/static/description/index.html new file mode 100644 index 00000000..e843c5f5 --- /dev/null +++ b/repair_views_kanban/static/description/index.html @@ -0,0 +1,437 @@ + + + + + +Repair Views Kanban + + + +
+

Repair Views Kanban

+ + +

Beta License: LGPL-3 OCA/repair Translate me on Weblate Try me on Runboat

+

This module provides mobile-optimized kanban views for repair orders, designed to improve usability on mobile devices and tablets.

+

Key Features: +- Mobile-First Kanban Views: Invoice-style kanban cards for repair parts (repair.line) and operations (repair.fee) +- Type-Based Visual Indicators: Color-coded icons showing add/remove operations with FontAwesome icons +- Responsive Design: Optimized layout for mobile devices (viewport ≤ 768px) +- Touch-Friendly Interface: Large touch targets and improved spacing for mobile interaction +- Dual View Mode: Seamless switching between tree and kanban views in repair order forms +- Visual Status Indicators: Clear display of invoiced status and operation types

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Binhex
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/repair project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/repair_views_kanban/static/src/js/list_renderer_mobile.esm.js b/repair_views_kanban/static/src/js/list_renderer_mobile.esm.js new file mode 100644 index 00000000..63d79176 --- /dev/null +++ b/repair_views_kanban/static/src/js/list_renderer_mobile.esm.js @@ -0,0 +1,133 @@ +/** @odoo-module **/ + +import {ListRenderer} from "@web/views/list/list_renderer"; +import {patch} from "@web/core/utils/patch"; + +patch(ListRenderer.prototype, "repair_views_kanban.ListRenderer", { + /** + * Override setDefaultColumnWidths to provide mobile-responsive behavior + * specifically for repair models + */ + setDefaultColumnWidths() { + // Always call the original method first + this._super(...arguments); + + // Then apply our mobile optimizations if needed + const isMobile = window.innerWidth <= 768; + const isRepairModel = + this.props.list.resModel && this.props.list.resModel.startsWith("repair"); + + if (isMobile && isRepairModel) { + console.log("Aplicando optimización móvil para repair"); + // Use setTimeout to ensure DOM is ready + setTimeout(() => { + this.setMobileRepairColumnWidths(); + }, 0); + } + }, + + /** + * Set mobile-optimized column widths for repair models + */ + setMobileRepairColumnWidths() { + const columns = this.state.columns; + if (columns.length === 0) return; + + console.log("Aplicando anchos auto-ajustables para repair móvil"); + + // Set table to auto layout for content-based sizing + if (this.tableRef.el) { + this.tableRef.el.style.tableLayout = "auto"; + this.tableRef.el.style.width = "100%"; + } + + const columnOffset = this.hasSelectors ? 2 : 1; + + // Apply mobile-optimized widths based on content and field type + columns.forEach((column, i) => { + const headerEl = this.tableRef.el.querySelector( + `th:nth-child(${i + columnOffset})` + ); + if (!headerEl) return; + + // Remove any fixed width constraints + headerEl.style.width = "auto"; + headerEl.style.minWidth = "auto"; + headerEl.style.maxWidth = "none"; + + if (column.type === "field") { + const fieldType = + column.widget || this.props.list.fields[column.name].type; + console.log(`Columna ${i}: ${column.name} (${fieldType})`); + + switch (fieldType) { + case "many2one": + // Set reasonable constraints for many2one + headerEl.style.minWidth = "80px"; + headerEl.style.maxWidth = "150px"; + break; + case "char": + case "text": + // Allow text fields to expand but set reasonable limits + headerEl.style.minWidth = "120px"; + headerEl.style.maxWidth = "250px"; + break; + case "float": + case "integer": + case "monetary": + // Numeric fields stay compact + headerEl.style.minWidth = "60px"; + headerEl.style.maxWidth = "100px"; + break; + case "boolean": + // Boolean fields very compact + headerEl.style.minWidth = "40px"; + headerEl.style.maxWidth = "60px"; + break; + case "date": + case "datetime": + // Date fields moderate width + headerEl.style.minWidth = "80px"; + headerEl.style.maxWidth = "120px"; + break; + default: + // Default flexible sizing + headerEl.style.minWidth = "80px"; + headerEl.style.maxWidth = "200px"; + break; + } + } + + // Ensure headers can adjust to their text content + headerEl.style.whiteSpace = "nowrap"; + headerEl.style.overflow = "visible"; + headerEl.style.textOverflow = "clip"; + }); + + // Apply same logic to body cells for consistency + const bodyRows = this.tableRef.el.querySelectorAll("tbody tr"); + bodyRows.forEach((row) => { + const cells = row.querySelectorAll("td"); + cells.forEach((cell, i) => { + if (i >= columnOffset - 1) { + // Adjust for selector offset + const columnIndex = i - (columnOffset - 1); + const column = columns[columnIndex]; + + if (column && column.type === "field") { + const fieldType = + column.widget || this.props.list.fields[column.name].type; + + // Apply consistent sizing to body cells + cell.style.overflow = "hidden"; + cell.style.textOverflow = "ellipsis"; + + if (fieldType === "boolean") { + cell.style.textAlign = "center"; + } + } + } + }); + }); + }, +}); diff --git a/repair_views_kanban/views/repair_views_kanban.xml b/repair_views_kanban/views/repair_views_kanban.xml new file mode 100644 index 00000000..5a1a9d87 --- /dev/null +++ b/repair_views_kanban/views/repair_views_kanban.xml @@ -0,0 +1,248 @@ + + + + + repair.order.line.kanban + repair.line + + + + + + + + + + + +
+ +
+
+
+ + + + + + +
+
+ + +
+ +
+ +
+ + +
+ Quantity: +
+ + +
+ Unit Price: +
+
+ + +
+
+ +
+ + +
+ + + Invoiced + + +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + repair.fee.kanban + repair.fee + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+ + +
+ Quantity: +
+ + +
+ Unit Price: +
+
+ + +
+
+ +
+ + +
+ + + Invoiced + + +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+ + + view.repair.order.form.inherit + repair.order + + + + tree,kanban + repair_order_line_view_kanban_mobile + + + tree,kanban + repair_fee_view_kanban_mobile + + + + +
diff --git a/setup/repair_views_kanban/odoo/addons/repair_views_kanban b/setup/repair_views_kanban/odoo/addons/repair_views_kanban new file mode 120000 index 00000000..85dd892a --- /dev/null +++ b/setup/repair_views_kanban/odoo/addons/repair_views_kanban @@ -0,0 +1 @@ +../../../../repair_views_kanban \ No newline at end of file diff --git a/setup/repair_views_kanban/setup.py b/setup/repair_views_kanban/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/repair_views_kanban/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)