-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[FIX] base_multi_image: Access Error #3285
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
base: 16.0
Are you sure you want to change the base?
[FIX] base_multi_image: Access Error #3285
Conversation
@legalsylvain @ivs-cetmix @Aldeigja please review |
@erlinberg thank you for you contribution! Did you manage to reproduce this error on the runboat? I checked it on 14.0 with "Product Multi Image" and looks like there are some other access error being raised. |
@ivs-cetmix I reproduced the issue on runboat by adding a simple view action called "Product Images Demo Action" to Sales, which includes a tree and form view for base_multi_image.image. I applied an owner domain and linked it to a menu item called "Product Images Demo", with access rights set for non-admin users. When opened by the demo user, an AccessError is raised because regular users don’t have access to the ir.model records that base_multi_image.image relies on. http://oca-server-tools-16-0-57c6d831b62d.runboat.odoo-community.org/ |
@erlinberg makes sense, thank you! Please also add a more complete description to the commit message. Eg:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review LGTM
@erlinberg please also add tests that cover your change. |
17c5f88
to
769f69b
Compare
**Before this commit** Access error is raised if user who doesn't have access to system settings tries to open a record that contains multiple images. **After this commit** Access error is not raised any longer because model list is fetched using `sudo`.
769f69b
to
4eee504
Compare
@ivs-cetmix Updated the commit message and added tests. Thanks! |
@erlinberg thank you! |
I encountered an AccessError when a non-admin user tries to access a
base_multi_image
form or tree view or when any model that inherits from base_multi_image is used. This error happens because theowner_ref_id
field computation tries to access their.model
table without sufficient permissions.To fix this, I added .sudo() to the
_selection_owner_ref_id
method to ensure the system has the necessary access rights to read from ir.model, regardless of the user's permissions.