[IMP] display a helper to add a tooltip on a field. Display the tooltip on list views. One tooltip per field and do not handle user specific tooltips

This commit is contained in:
Benjamin Willig
2023-08-01 10:40:55 +02:00
parent 9974308140
commit 3c5ef90a2e
14 changed files with 362 additions and 163 deletions

View File

@@ -0,0 +1,31 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
TOOLTIP_MANAGER_GROUP = "web_field_tooltip.group_tooltip_manager"
class ResUsers(models.Model):
_inherit = "res.users"
tooltip_show_add_helper = fields.Boolean(
string="Show helper to add tooltips on fields",
)
tooltip_show_add_helper_allowed = fields.Boolean(
compute="_compute_tooltip_show_add_helper_allowed"
)
def __init__(self, pool, cr):
super().__init__(pool, cr)
field_names = ["tooltip_show_add_helper"]
self.SELF_READABLE_FIELDS.extend(field_names)
self.SELF_WRITEABLE_FIELDS.extend(field_names)
def _compute_tooltip_show_add_helper_allowed(self):
for rec in self:
rec.tooltip_show_add_helper_allowed = rec._is_tooltip_manager()
def _is_tooltip_manager(self):
self.ensure_one()
return self.has_group(TOOLTIP_MANAGER_GROUP)