diff --git a/setup/web_field_tooltip/odoo/addons/web_field_tooltip b/setup/web_field_tooltip/odoo/addons/web_field_tooltip new file mode 120000 index 000000000..aa35a5cb6 --- /dev/null +++ b/setup/web_field_tooltip/odoo/addons/web_field_tooltip @@ -0,0 +1 @@ +../../../../web_field_tooltip \ No newline at end of file diff --git a/setup/web_field_tooltip/setup.py b/setup/web_field_tooltip/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_field_tooltip/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_field_tooltip/README.rst b/web_field_tooltip/README.rst new file mode 100644 index 000000000..d79700426 --- /dev/null +++ b/web_field_tooltip/README.rst @@ -0,0 +1,98 @@ +================= +Web Field Tooltip +================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:dfb68ce3f667c6468d8a78650442321a2b1f529ef807331a5145efe8ad322c65 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-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/13.0/web_field_tooltip + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_field_tooltip + :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=13.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module gives the possibility to add tooltips next to fields labels on any +field of a model. The tooltip displays an html field that can contain links and +the name of the user that last updated it. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +* Go to Settings / Technical / Database Structure / Fields Tooltips and + configure tooltips for a field for a model. You will then be able to see + on the form view of the model you chose, next to the label of the field you + selected, the tooltip appear. + +* You can also go directly on the form view of a model on which you want to + add a tooltip and use the Manage tooltips Action to add a new tooltip, or edit + or delete existing tooltips for this model. + +* Internal Users can read all created tooltips. Then there are two new groups: + + * Tooltip users who are able to manage their own tooltips. + + * Tooltip managers who are able to manage all tooltips. + +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 +~~~~~~~ + +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +* Benoit Aimont (https://www.acsone.eu/) + +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/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_field_tooltip/__init__.py b/web_field_tooltip/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/web_field_tooltip/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_field_tooltip/__manifest__.py b/web_field_tooltip/__manifest__.py new file mode 100644 index 000000000..737f58080 --- /dev/null +++ b/web_field_tooltip/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2019 - TODAY Serpent Consulting Services Pvt. Ltd. +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Web Field Tooltip", + "summary": """ + Displays customizable tooltips for fields""", + "version": "13.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "depends": ["web"], + "data": [ + "security/res_groups.xml", + "security/ir_model_access.xml", + "security/ir_rule.xml", + "views/ir_model_fields_tooltip.xml", + "views/template.xml", + ], +} diff --git a/web_field_tooltip/i18n/fr.po b/web_field_tooltip/i18n/fr.po new file mode 100644 index 000000000..69dcf7a8c --- /dev/null +++ b/web_field_tooltip/i18n/fr.po @@ -0,0 +1,169 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_field_tooltip +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-06 07:59+0000\n" +"PO-Revision-Date: 2023-07-06 07:42+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_field_tooltip +#: code:addons/web_field_tooltip/models/ir_model_fields_tooltip.py:0 +#, python-format +msgid "A tooltip already exists for this field" +msgstr "Une infobulle existe déjà pour ce champ" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__active +msgid "Active" +msgstr "Active" + +#. module: web_field_tooltip +#: model_terms:ir.ui.view,arch_db:web_field_tooltip.ir_model_fields_tooltip_form_view +#: model_terms:ir.ui.view,arch_db:web_field_tooltip.ir_model_fields_tooltip_search_view +msgid "Archived" +msgstr "Archivé" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Edit a Tooltip" +msgstr "Modifier une infobulle" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Edit the tooltip" +msgstr "Modifier l'infobulle" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__field_id +msgid "Field" +msgstr "Champ" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__field_name +msgid "Field Name" +msgstr "Nom de Champ" + +#. module: web_field_tooltip +#: model:ir.model,name:web_field_tooltip.model_ir_model_fields_tooltip +msgid "Field Tooltip" +msgstr "Infobulle de Champ" + +#. module: web_field_tooltip +#: model:ir.actions.act_window,name:web_field_tooltip.ir_model_fields_tooltip_act_window +#: model:ir.ui.menu,name:web_field_tooltip.ir_model_fields_tooltip_menu +msgid "Fields Tooltips" +msgstr "Infobulles" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__id +msgid "ID" +msgstr "ID" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Last Updated by: " +msgstr "Dernière mise à jour par " + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Manage Tooltips" +msgstr "Gérer les Infobulles" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__model_id +msgid "Model" +msgstr "Modèle" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__model +msgid "Model Name" +msgstr "Nom de Modèle" + +#. module: web_field_tooltip +#: model:ir.model.fields,help:web_field_tooltip.field_ir_model_fields_tooltip__model_id +msgid "Model for the Field Tooltip." +msgstr "Modèle pour l'Infobulle de Champ" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__name +msgid "Name" +msgstr "Nom" + +#. module: web_field_tooltip +#: model:ir.model.fields,help:web_field_tooltip.field_ir_model_fields_tooltip__active +msgid "Set active to false to hide the Tooltip without removing it." +msgstr "" +"Mettre le champ actif à faux pour masquer l'Infobulle sans la supprimer." + +#. module: web_field_tooltip +#: model:res.groups,comment:web_field_tooltip.group_tooltip_manager +msgid "The user will be able to manage all the tooltips." +msgstr "L'utilisateur pourra gérer toutes les infobulles." + +#. module: web_field_tooltip +#: model:res.groups,comment:web_field_tooltip.group_tooltip_user +msgid "The user will be able to manage his own tooltips." +msgstr "L'utilisateur pourra gérer ses infobulles." + +#. module: web_field_tooltip +#: model:res.groups,name:web_field_tooltip.group_tooltip_manager +msgid "Tooltip Manager" +msgstr "Gestionnaire des infobulles" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__tooltip_text +msgid "Tooltip Text" +msgstr "Texte de l'Infobulle" + +#. module: web_field_tooltip +#: model:res.groups,name:web_field_tooltip.group_tooltip_user +msgid "Tooltip User" +msgstr "Utilisateur des infobulles" diff --git a/web_field_tooltip/i18n/web_field_tooltip.pot b/web_field_tooltip/i18n/web_field_tooltip.pot new file mode 100644 index 000000000..30f83ba14 --- /dev/null +++ b/web_field_tooltip/i18n/web_field_tooltip.pot @@ -0,0 +1,168 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_field_tooltip +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-06 07:59+0000\n" +"PO-Revision-Date: 2023-07-06 07:59+0000\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_field_tooltip +#: code:addons/web_field_tooltip/models/ir_model_fields_tooltip.py:0 +#, python-format +msgid "A tooltip already exists for this field" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__active +msgid "Active" +msgstr "" + +#. module: web_field_tooltip +#: model_terms:ir.ui.view,arch_db:web_field_tooltip.ir_model_fields_tooltip_form_view +#: model_terms:ir.ui.view,arch_db:web_field_tooltip.ir_model_fields_tooltip_search_view +msgid "Archived" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__create_uid +msgid "Created by" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__create_date +msgid "Created on" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__display_name +msgid "Display Name" +msgstr "" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Edit a Tooltip" +msgstr "" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Edit the tooltip" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__field_id +msgid "Field" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__field_name +msgid "Field Name" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model,name:web_field_tooltip.model_ir_model_fields_tooltip +msgid "Field Tooltip" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.actions.act_window,name:web_field_tooltip.ir_model_fields_tooltip_act_window +#: model:ir.ui.menu,name:web_field_tooltip.ir_model_fields_tooltip_menu +msgid "Fields Tooltips" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__id +msgid "ID" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip____last_update +msgid "Last Modified on" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Last Updated by: " +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__write_date +msgid "Last Updated on" +msgstr "" + +#. module: web_field_tooltip +#. openerp-web +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#: code:addons/web_field_tooltip/static/src/js/web_field_tooltip.js:0 +#, python-format +msgid "Manage Tooltips" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__model_id +msgid "Model" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__model +msgid "Model Name" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,help:web_field_tooltip.field_ir_model_fields_tooltip__model_id +msgid "Model for the Field Tooltip." +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__name +msgid "Name" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,help:web_field_tooltip.field_ir_model_fields_tooltip__active +msgid "Set active to false to hide the Tooltip without removing it." +msgstr "" + +#. module: web_field_tooltip +#: model:res.groups,comment:web_field_tooltip.group_tooltip_manager +msgid "The user will be able to manage all the tooltips." +msgstr "" + +#. module: web_field_tooltip +#: model:res.groups,comment:web_field_tooltip.group_tooltip_user +msgid "The user will be able to manage his own tooltips." +msgstr "" + +#. module: web_field_tooltip +#: model:res.groups,name:web_field_tooltip.group_tooltip_manager +msgid "Tooltip Manager" +msgstr "" + +#. module: web_field_tooltip +#: model:ir.model.fields,field_description:web_field_tooltip.field_ir_model_fields_tooltip__tooltip_text +msgid "Tooltip Text" +msgstr "" + +#. module: web_field_tooltip +#: model:res.groups,name:web_field_tooltip.group_tooltip_user +msgid "Tooltip User" +msgstr "" diff --git a/web_field_tooltip/models/__init__.py b/web_field_tooltip/models/__init__.py new file mode 100644 index 000000000..3f770ce85 --- /dev/null +++ b/web_field_tooltip/models/__init__.py @@ -0,0 +1 @@ +from . import ir_model_fields_tooltip diff --git a/web_field_tooltip/models/ir_model_fields_tooltip.py b/web_field_tooltip/models/ir_model_fields_tooltip.py new file mode 100644 index 000000000..fc595ed85 --- /dev/null +++ b/web_field_tooltip/models/ir_model_fields_tooltip.py @@ -0,0 +1,58 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class IrModelFieldsTooltip(models.Model): + + _name = "ir.model.fields.tooltip" + _description = "Field Tooltip" + + model_id = fields.Many2one( + string="Model", + comodel_name="ir.model", + ondelete="cascade", + required=True, + help="Model for the Field Tooltip.", + default=lambda self: self._get_default_model_id(), + ) + model = fields.Char(related="model_id.model", string="Model Name") + field_id = fields.Many2one( + string="Field", + required=True, + comodel_name="ir.model.fields", + ondelete="cascade", + ) + name = fields.Char(compute="_compute_name", readonly=True,) + active = fields.Boolean( + default=True, + help="Set active to false to hide the Tooltip without removing it.", + ) + field_name = fields.Char(related="field_id.name") + tooltip_text = fields.Html(string="Tooltip Text") + + @api.constrains("model_id", "field_id") + def _check_duplicate_tooltip(self): + for rec in self: + if self.search( + [ + ("model_id", "=", rec.model_id.id), + ("field_id", "=", rec.field_id.id), + ("id", "!=", rec.id), + ] + ): + raise UserError(_("A tooltip already exists for this field")) + + def _get_default_model_id(self): + tooltip_model = self.env.context.get("tooltip_model") + model = self.env["ir.model"].search([("model", "=", tooltip_model)], limit=1) + return model.id or False + + @api.depends("model_id", "field_id") + def _compute_name(self): + for tooltip in self: + tooltip.name = "Tooltip for {} on {}".format( + tooltip.field_id.name, tooltip.model_id.name + ) diff --git a/web_field_tooltip/readme/CONTRIBUTORS.rst b/web_field_tooltip/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..98f0ee188 --- /dev/null +++ b/web_field_tooltip/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Benoit Aimont (https://www.acsone.eu/) diff --git a/web_field_tooltip/readme/DESCRIPTION.rst b/web_field_tooltip/readme/DESCRIPTION.rst new file mode 100644 index 000000000..84bf1c5e6 --- /dev/null +++ b/web_field_tooltip/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module gives the possibility to add tooltips next to fields labels on any +field of a model. The tooltip displays an html field that can contain links and +the name of the user that last updated it. diff --git a/web_field_tooltip/readme/USAGE.rst b/web_field_tooltip/readme/USAGE.rst new file mode 100644 index 000000000..8e86a2098 --- /dev/null +++ b/web_field_tooltip/readme/USAGE.rst @@ -0,0 +1,16 @@ +To use this module, you need to: + +* Go to Settings / Technical / Database Structure / Fields Tooltips and + configure tooltips for a field for a model. You will then be able to see + on the form view of the model you chose, next to the label of the field you + selected, the tooltip appear. + +* You can also go directly on the form view of a model on which you want to + add a tooltip and use the Manage tooltips Action to add a new tooltip, or edit + or delete existing tooltips for this model. + +* Internal Users can read all created tooltips. Then there are two new groups: + + * Tooltip users who are able to manage their own tooltips. + + * Tooltip managers who are able to manage all tooltips. diff --git a/web_field_tooltip/security/ir_model_access.xml b/web_field_tooltip/security/ir_model_access.xml new file mode 100644 index 000000000..0412c0969 --- /dev/null +++ b/web_field_tooltip/security/ir_model_access.xml @@ -0,0 +1,26 @@ + + + + + + ir.model.fields.tooltip access reader + + + + + + + + + + ir.model.fields.tooltip access user + + + + + + + + + diff --git a/web_field_tooltip/security/ir_rule.xml b/web_field_tooltip/security/ir_rule.xml new file mode 100644 index 000000000..ea5cdf58a --- /dev/null +++ b/web_field_tooltip/security/ir_rule.xml @@ -0,0 +1,36 @@ + + + + + + All Tooltips + + [(1, '=', 1)] + + + + + Tooltips per user + + [('create_uid','=', user.id)] + + + + + Tooltips read access is for everyone + + [(1, '=', 1)] + + + + + + + diff --git a/web_field_tooltip/security/res_groups.xml b/web_field_tooltip/security/res_groups.xml new file mode 100644 index 000000000..009a46cd3 --- /dev/null +++ b/web_field_tooltip/security/res_groups.xml @@ -0,0 +1,27 @@ + + + + + + Tooltip User + + + The user will be able to manage his own tooltips. + + + + Tooltip Manager + + + The user will be able to manage all the tooltips. + + + + diff --git a/web_field_tooltip/static/description/icon.png b/web_field_tooltip/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_field_tooltip/static/description/icon.png differ diff --git a/web_field_tooltip/static/description/index.html b/web_field_tooltip/static/description/index.html new file mode 100644 index 000000000..9721cb3ca --- /dev/null +++ b/web_field_tooltip/static/description/index.html @@ -0,0 +1,442 @@ + + + + + + +Web Field Tooltip + + + +
+

Web Field Tooltip

+ + +

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

+

This module gives the possibility to add tooltips next to fields labels on any +field of a model. The tooltip displays an html field that can contain links and +the name of the user that last updated it.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Go to Settings / Technical / Database Structure / Fields Tooltips and +configure tooltips for a field for a model. You will then be able to see +on the form view of the model you chose, next to the label of the field you +selected, the tooltip appear.
  • +
  • You can also go directly on the form view of a model on which you want to +add a tooltip and use the Manage tooltips Action to add a new tooltip, or edit +or delete existing tooltips for this model.
  • +
  • Internal Users can read all created tooltips. Then there are two new groups:
      +
    • Tooltip users who are able to manage their own tooltips.
    • +
    • Tooltip managers who are able to manage all tooltips.
    • +
    +
  • +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+ +
+

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/web project on GitHub.

+

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

+
+
+
+ + diff --git a/web_field_tooltip/static/src/css/web_field_tooltip.css b/web_field_tooltip/static/src/css/web_field_tooltip.css new file mode 100644 index 000000000..637c2825f --- /dev/null +++ b/web_field_tooltip/static/src/css/web_field_tooltip.css @@ -0,0 +1,12 @@ +.tooltip-icon { + color: #666666; + margin-left: 5px; + background: none; + border: none; +} + +.popover-footer { + margin: 0; + padding: 8px 14px; + background-color: #f7f7f7; +} diff --git a/web_field_tooltip/static/src/js/web_field_tooltip.js b/web_field_tooltip/static/src/js/web_field_tooltip.js new file mode 100644 index 000000000..79d0c1ef4 --- /dev/null +++ b/web_field_tooltip/static/src/js/web_field_tooltip.js @@ -0,0 +1,131 @@ +/* Copyright 2023 ACSONE SA/NV + Copyright 2019 TODAY Serpent Consulting Services Pvt. Ltd. + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define("web_field_tooltip.FieldTooltip", function(require) { + "use strict"; + + var core = require("web.core"); + var FormRenderer = require("web.FormRenderer"); + var FormController = require("web.FormController"); + var field_utils = require("web.field_utils"); + var rpc = require("web.rpc"); + var _t = core._t; + + FormRenderer.include({ + /** + * @override + */ + _renderTagLabel: function(node) { + var self = this; + var $result = this._super.apply(this, arguments); + var fieldName = node.tag === "label" ? node.attrs.for : node.attrs.name; + + // Check if there's any tooltip that must be rendered for the given view + + rpc.query({ + model: "ir.model.fields.tooltip", + method: "search_read", + domain: [ + ["field_name", "=", fieldName], + ["model", "=", self.state.model], + ], + }).then(function(data) { + if (data) { + _.each(data, function(tooltip) { + if (tooltip) { + var $after_elem = $("