diff --git a/setup/web_touchscreen/odoo/addons/web_touchscreen b/setup/web_touchscreen/odoo/addons/web_touchscreen new file mode 120000 index 000000000..5bfac7c2e --- /dev/null +++ b/setup/web_touchscreen/odoo/addons/web_touchscreen @@ -0,0 +1 @@ +../../../../web_touchscreen \ No newline at end of file diff --git a/setup/web_touchscreen/setup.py b/setup/web_touchscreen/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_touchscreen/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_touchscreen/README.rst b/web_touchscreen/README.rst new file mode 100644 index 000000000..37c1378ac --- /dev/null +++ b/web_touchscreen/README.rst @@ -0,0 +1,130 @@ +=============== +Web Touchscreen +=============== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e5b59e225d718b18262fbc8a0da3408dc0fd5523eaf421014865f22d3ab9b5e1 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/16.0/web_touchscreen + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_touchscreen + :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/web&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module prefers kanban sub-form views when using a tablet, or any +other device with a touch screen, no matter its size. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +This module was developed because Odoo optimizes views only for mobile +or desktop, but forgets about tablets. + +It will be useful for you if you usually use a tablet. + +If you need this module for those reasons, these might interest you too: + +- ``web_widget_numeric_step`` +- OCA's ``web_responsive``, or the Odoo EE alternative + ``web_enterprise`` (closed source). + +Usage +===== + +To use this module, you need to: + +1. Use a tablet. +2. Go to any form that contains a sub-view which can be optimized for + mobile. + +Known issues / Roadmap +====================== + +- Enable more mobile UI enhancements for tablets as they seem relevant. +- Allow setting per user or per session, with sane defaults. Just in + case you happen to use a tablet with a mouse. + +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 +------- + +* Moduon + +Contributors +------------ + +- Jairo Llopis (`Moduon `__) + +Other credits +------------- + +The development of this module has been financially supported by: + +- Moduon Team S.L. + +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. + +.. |maintainer-yajo| image:: https://github.com/yajo.png?size=40px + :target: https://github.com/yajo + :alt: yajo +.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px + :target: https://github.com/rafaelbn + :alt: rafaelbn + +Current `maintainers `__: + +|maintainer-yajo| |maintainer-rafaelbn| + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_touchscreen/__init__.py b/web_touchscreen/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web_touchscreen/__manifest__.py b/web_touchscreen/__manifest__.py new file mode 100644 index 000000000..10e568c4f --- /dev/null +++ b/web_touchscreen/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2023 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) + +{ + "name": "Web Touchscreen", + "summary": "UX improvements for touch screens", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Extra Tools", + "website": "https://github.com/OCA/web", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["yajo", "rafaelbn"], + "license": "LGPL-3", + "application": False, + "installable": True, + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "web_touchscreen/static/src/**/*", + ], + }, +} diff --git a/web_touchscreen/readme/CONTEXT.md b/web_touchscreen/readme/CONTEXT.md new file mode 100644 index 000000000..a2465de1e --- /dev/null +++ b/web_touchscreen/readme/CONTEXT.md @@ -0,0 +1,9 @@ +This module was developed because Odoo optimizes views only for mobile or desktop, but +forgets about tablets. + +It will be useful for you if you usually use a tablet. + +If you need this module for those reasons, these might interest you too: + +- `web_widget_numeric_step` +- OCA's `web_responsive`, or the Odoo EE alternative `web_enterprise` (closed source). diff --git a/web_touchscreen/readme/CONTRIBUTORS.md b/web_touchscreen/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..ad3bdb215 --- /dev/null +++ b/web_touchscreen/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Jairo Llopis ([Moduon](https://www.moduon.team/)) diff --git a/web_touchscreen/readme/CREDITS.md b/web_touchscreen/readme/CREDITS.md new file mode 100644 index 000000000..98d1eaf17 --- /dev/null +++ b/web_touchscreen/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +- Moduon Team S.L. diff --git a/web_touchscreen/readme/DESCRIPTION.md b/web_touchscreen/readme/DESCRIPTION.md new file mode 100644 index 000000000..ed6039761 --- /dev/null +++ b/web_touchscreen/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module prefers kanban sub-form views when using a tablet, or any other +device with a touch screen, no matter its size. diff --git a/web_touchscreen/readme/ROADMAP.md b/web_touchscreen/readme/ROADMAP.md new file mode 100644 index 000000000..cb971ce7a --- /dev/null +++ b/web_touchscreen/readme/ROADMAP.md @@ -0,0 +1,3 @@ +- Enable more mobile UI enhancements for tablets as they seem relevant. +- Allow setting per user or per session, with sane defaults. Just in case you happen to + use a tablet with a mouse. diff --git a/web_touchscreen/readme/USAGE.md b/web_touchscreen/readme/USAGE.md new file mode 100644 index 000000000..e3fd62127 --- /dev/null +++ b/web_touchscreen/readme/USAGE.md @@ -0,0 +1,4 @@ +To use this module, you need to: + +1. Use a tablet. +1. Go to any form that contains a sub-view which can be optimized for mobile. diff --git a/web_touchscreen/static/description/icon.png b/web_touchscreen/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_touchscreen/static/description/icon.png differ diff --git a/web_touchscreen/static/description/index.html b/web_touchscreen/static/description/index.html new file mode 100644 index 000000000..900c7a5d3 --- /dev/null +++ b/web_touchscreen/static/description/index.html @@ -0,0 +1,470 @@ + + + + + + +Web Touchscreen + + + +
+

Web Touchscreen

+ + +

Alpha License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This module prefers kanban sub-form views when using a tablet, or any +other device with a touch screen, no matter its size.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Use Cases / Context

+

This module was developed because Odoo optimizes views only for mobile +or desktop, but forgets about tablets.

+

It will be useful for you if you usually use a tablet.

+

If you need this module for those reasons, these might interest you too:

+
    +
  • web_widget_numeric_step
  • +
  • OCA’s web_responsive, or the Odoo EE alternative +web_enterprise (closed source).
  • +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Use a tablet.
  2. +
  3. Go to any form that contains a sub-view which can be optimized for +mobile.
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • Enable more mobile UI enhancements for tablets as they seem relevant.
  • +
  • Allow setting per user or per session, with sane defaults. Just in +case you happen to use a tablet with a mouse.
  • +
+
+
+

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

+
    +
  • Moduon
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Moduon Team S.L.
  • +
+
+
+

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.

+

Current maintainers:

+

yajo rafaelbn

+

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

+

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

+
+
+
+ + diff --git a/web_touchscreen/static/src/form_controller.esm.js b/web_touchscreen/static/src/form_controller.esm.js new file mode 100644 index 000000000..e4e7c1b86 --- /dev/null +++ b/web_touchscreen/static/src/form_controller.esm.js @@ -0,0 +1,21 @@ +/** @odoo-module **/ +/* Copyright 2023 Moduon Team S.L. + * License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) */ + +import {FormController} from "@web/views/form/form_controller"; +import {patch} from "@web/core/utils/patch"; +import {hasTouch} from "@web/core/browser/feature_detection"; + +patch(FormController.prototype, "web_touchscreen.FormController", { + setup() { + const wasSmall = this.env.isSmall; + // Create a new env that extends the original one but overrides the way + // Odoo considers this device small: it will be small if it has touch + // capabilities, not only if the screen is small. In practice, this + // will make the inline subforms prefer the kanban mode if possible. + const newEnv = {isSmall: wasSmall || hasTouch()}; + Object.setPrototypeOf(newEnv, this.env); + this.env = newEnv; + return this._super(...arguments); + }, +});