-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] display a helper to add a tooltip on a field. Display the toolt…
…ip on list views. One tooltip per field and do not handle user specific tooltips
- Loading branch information
Showing
14 changed files
with
363 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from . import ir_http | ||
from . import ir_model_fields_tooltip | ||
from . import res_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class Http(models.AbstractModel): | ||
_inherit = "ir.http" | ||
|
||
def session_info(self): | ||
result = super().session_info() | ||
user = self.env.user | ||
result.update( | ||
{ | ||
"can_manage_tooltips": user._is_tooltip_manager(), | ||
"tooltip_show_add_helper": user.tooltip_show_add_helper, | ||
} | ||
) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.