diff --git a/web_widget_popover/README.rst b/web_widget_popover/README.rst new file mode 100644 index 000000000000..03fb08748a9f --- /dev/null +++ b/web_widget_popover/README.rst @@ -0,0 +1,107 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================== +Web Widget Popover +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e85087d8c8563b533d661d4388f5344a47a389b3dae799dbdc9bc53d6977cc77 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/19.0/web_widget_popover + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_widget_popover + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +The field will be rendered as a simple icon, that when hovered will +display the field content as a tooltip. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Use the ``popover`` widget on ``Char`` or ``Text`` fields. + +.. code:: xml + + + +In list views, use ``nolabel="1"`` to hide the column header: the column +is then kept as narrow as the icon. + +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 +------- + +* Camptocamp + +Contributors +------------ + +- Iván Todorovich + +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-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px + :target: https://github.com/ivantodorovich + :alt: ivantodorovich + +Current `maintainer `__: + +|maintainer-ivantodorovich| + +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_widget_popover/__init__.py b/web_widget_popover/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_widget_popover/__manifest__.py b/web_widget_popover/__manifest__.py new file mode 100644 index 000000000000..a2aa9cf94b4b --- /dev/null +++ b/web_widget_popover/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2025 Camptocamp SA (https://www.camptocamp.com). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Web Widget Popover", + "summary": "Render an icon that displays the field content in a popover", + "version": "19.0.1.0.0", + "author": "Camptocamp, Odoo Community Association (OCA)", + "maintainers": ["ivantodorovich"], + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "category": "Web", + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "web_widget_popover/static/src/**/*.js", + "web_widget_popover/static/src/**/*.xml", + ], + }, +} diff --git a/web_widget_popover/i18n/it.po b/web_widget_popover/i18n/it.po new file mode 100644 index 000000000000..c8fe2b03e1fe --- /dev/null +++ b/web_widget_popover/i18n/it.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_popover +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-11-11 11:23+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.10.4\n" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "FontAwesome icon to display" +msgstr "Icona FontAwesome da visualizzare" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon" +msgstr "Icona" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon Popover" +msgstr "Icona Popover" diff --git a/web_widget_popover/i18n/sl.po b/web_widget_popover/i18n/sl.po new file mode 100644 index 000000000000..47d7d1a98956 --- /dev/null +++ b/web_widget_popover/i18n/sl.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_popover +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-07 06:54+0000\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: none\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3;\n" +"X-Generator: Weblate 5.15.2\n" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "FontAwesome icon to display" +msgstr "Ikona FontAwesome za prikaz" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon" +msgstr "Ikona" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon Popover" +msgstr "Pojavno okno z ikonami" diff --git a/web_widget_popover/i18n/web_widget_popover.pot b/web_widget_popover/i18n/web_widget_popover.pot new file mode 100644 index 000000000000..3af332bea7e8 --- /dev/null +++ b/web_widget_popover/i18n/web_widget_popover.pot @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_widget_popover +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "FontAwesome icon to display" +msgstr "" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon" +msgstr "" + +#. module: web_widget_popover +#. odoo-javascript +#: code:addons/web_widget_popover/static/src/popover.esm.js:0 +msgid "Icon Popover" +msgstr "" diff --git a/web_widget_popover/pyproject.toml b/web_widget_popover/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/web_widget_popover/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_popover/readme/CONTRIBUTORS.md b/web_widget_popover/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..45388bedc364 --- /dev/null +++ b/web_widget_popover/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Iván Todorovich \<\> diff --git a/web_widget_popover/readme/DESCRIPTION.md b/web_widget_popover/readme/DESCRIPTION.md new file mode 100644 index 000000000000..b9de948365c0 --- /dev/null +++ b/web_widget_popover/readme/DESCRIPTION.md @@ -0,0 +1 @@ +The field will be rendered as a simple icon, that when hovered will display the field content as a tooltip. diff --git a/web_widget_popover/readme/USAGE.md b/web_widget_popover/readme/USAGE.md new file mode 100644 index 000000000000..282beb3c3ffd --- /dev/null +++ b/web_widget_popover/readme/USAGE.md @@ -0,0 +1,14 @@ +Use the `popover` widget on `Char` or `Text` fields. + +```xml + +``` + +In list views, use `nolabel="1"` to hide the column header: the column is then +kept as narrow as the icon. diff --git a/web_widget_popover/static/description/icon.png b/web_widget_popover/static/description/icon.png new file mode 100644 index 000000000000..1dcc49c24f36 Binary files /dev/null and b/web_widget_popover/static/description/icon.png differ diff --git a/web_widget_popover/static/description/index.html b/web_widget_popover/static/description/index.html new file mode 100644 index 000000000000..bfeaedc325e5 --- /dev/null +++ b/web_widget_popover/static/description/index.html @@ -0,0 +1,448 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Web Widget Popover

+ +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

The field will be rendered as a simple icon, that when hovered will +display the field content as a tooltip.

+

Table of contents

+ +
+

Usage

+

Use the popover widget on Char or Text fields.

+
+<field
+    name="warning_message"
+    widget="popover"
+    icon="fa-warning"
+    class="text-danger"
+    nolabel="1"
+/>
+
+

In list views, use nolabel="1" to hide the column header: the column +is then kept as narrow as the icon.

+
+
+

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

+
    +
  • Camptocamp
  • +
+
+
+

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.

+

Current maintainer:

+

ivantodorovich

+

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_widget_popover/static/src/popover.esm.js b/web_widget_popover/static/src/popover.esm.js new file mode 100644 index 000000000000..13dd88ff82a7 --- /dev/null +++ b/web_widget_popover/static/src/popover.esm.js @@ -0,0 +1,43 @@ +import {_t} from "@web/core/l10n/translation"; +import {Component} from "@odoo/owl"; +import {registry} from "@web/core/registry"; +import {standardFieldProps} from "@web/views/fields/standard_field_props"; + +export class IconPopoverField extends Component { + static template = "web_widget_popover.IconPopoverField"; + static props = { + ...standardFieldProps, + icon: {type: String, optional: true}, + }; + static defaultProps = { + icon: "fa-info-circle", + }; + get value() { + return this.props.record.data[this.props.name] || ""; + } + get tooltipInfo() { + return JSON.stringify({message: this.value}); + } +} + +export const iconPopoverField = { + component: IconPopoverField, + displayName: _t("Icon Popover"), + supportedTypes: ["char", "text"], + // In list views the column only holds an icon: keep it as narrow as the + // handle column, unless a header label is displayed. + listViewWidth: ({hasLabel}) => (hasLabel ? false : 20), + supportedOptions: [ + { + label: _t("Icon"), + name: "icon", + type: "string", + help: _t("FontAwesome icon to display"), + }, + ], + extractProps: ({attrs}) => ({ + icon: attrs.icon, + }), +}; + +registry.category("fields").add("popover", iconPopoverField); diff --git a/web_widget_popover/static/src/popover.xml b/web_widget_popover/static/src/popover.xml new file mode 100644 index 000000000000..498cb70340b9 --- /dev/null +++ b/web_widget_popover/static/src/popover.xml @@ -0,0 +1,21 @@ + + + + + + + + + +
+ +
+
+ +