Skip to content

Conversation

@yotsubasuzu
Copy link

@yotsubasuzu yotsubasuzu commented Jul 21, 2025

Description of the issue/feature this PR addresses:
In the repository OCA/POS PR test with OCB have been failing since PR #1301 was merged.
You can see an example of the failing test here: https://github.com/OCA/pos/actions/runs/16340188713/job/46160658528?pr=1406#step:8:147.

image

The failures occur because PR#1301 disables the base_install_request auto-install mechanism, which previously granted implicit read access to the ir.module.module model for users in the base.group_user group. With that mechanism turned off, these users now receive an AccessError when attempting to read ir.module.module in code paths such as:

(pos.session.load_data)[https://github.com/odoo/odoo/blob/18.0/addons/point_of_sale/models/pos_session.py#L185]

Desired behavior after PR is merged:
This PR adds sudo to elevated access to search_read method in the ir.module.module model.

Related Works
In parallel, I have submitted PR odoo#219367 to the Odoo main repository to address this issues with the same changes in the same context.


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@yotsubasuzu yotsubasuzu marked this pull request as draft July 21, 2025 16:16
@yotsubasuzu yotsubasuzu marked this pull request as ready for review July 22, 2025 04:54
@pedrobaeza
Copy link
Member

This is not the proper solution, but to put sudo in this read:

'data': self.search_read(domain, fields, load=False),

And this is an Odoo bug, but it's covered by the auto-install mechanism, but this doesn't mean it's correct. Please propose the patch in odoo/odoo as well.

@yotsubasuzu yotsubasuzu force-pushed the 18.0-fix-missing-access-right branch from 5032ec8 to 7e96d13 Compare July 22, 2025 08:09
@yotsubasuzu
Copy link
Author

Thank you Pedro, I have update the code as you suggested and in odoo/odoo PR as well.

Previously, users in the base.group_user group encountered an AccessError when attempting to read the ir.module.module model. This was due to the base_install_request auto-install mechanism being disabled, which removed the implicit read access that non-admin users previously relied on.

To resolve this issue, this commit updates the _load_pos_data method to explicitly elevate privileges using sudo() when calling search_read() on the model. This ensures that the operation is executed with administrative rights, allowing all users to retrieve module metadata safely, regardless of their group permissions.
@yotsubasuzu yotsubasuzu force-pushed the 18.0-fix-missing-access-right branch from 7e96d13 to 7b320b4 Compare July 22, 2025 08:43
@yotsubasuzu yotsubasuzu changed the title [18.0][FIX] point_of_sale: Grant base.group_user read access to ir.module.module [18.0][FIX] point_of_sale: search_read with elevated access Jul 22, 2025
@pedrobaeza pedrobaeza added this to the 18.0 milestone Jul 22, 2025
@pedrobaeza
Copy link
Member

Can you please propose the same to odoo/odoo first? It's better if it's fixed upstream.

@yotsubasuzu
Copy link
Author

Yeah it's the PR I mentioned above, still waiting for their reviews.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants