Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] web_field_tooltip: access to ir.model and ir.model.fields… #2823

Merged

Conversation

glitchov
Copy link
Contributor

@glitchov glitchov commented May 15, 2024

If you are not admin you can't create any new tooltip as a tooltips manager because of the access to ir.model and ir.model.fields. Giving read access to this specific tooltip manager group seems to be acceptable.

web_field_tooltip/models/ir_model_fields_tooltip.py Outdated Show resolved Hide resolved
rec.env["ir.model.fields"].sudo().browse(rec.proxy_field_id.id)
if rec.proxy_field_id
else False
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here with the field

web_field_tooltip/models/ir_model_fields_proxy.py Outdated Show resolved Hide resolved

id = fields.Integer()
name = fields.Char(string="Model Name")
description = fields.Char(translate=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the SQL view won't handle the translate properly. So maybe a compute would be better here. All fields should be readonly too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SQL view extract the jsonb so declaring the field translate=True enable the Odoo mechanism to handle it properly.

web_field_tooltip/models/ir_model_fields_tooltip.py Outdated Show resolved Hide resolved
_logger = logging.getLogger(__name__)


@openupgrade.migrate(use_env=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should use openupgrade only for two simple queries.

@glitchov glitchov force-pushed the 16.0-fix-web_field_tooltip_ir_model_access-hda branch from 1ae099c to 70efc5a Compare May 16, 2024 12:22
@dreispt
Copy link
Sponsor Member

dreispt commented May 18, 2024

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-2823-by-dreispt-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 6983eee into OCA:16.0 May 18, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at aa0d32a. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants