You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to display a BoM in read-only mode to a user with limited permissions, odoo raises a permission error stating that the user needs write access to mrp.bom.line, even though they're only trying to view the bom.
Create a user with read-only access to BoMs (without write permissions on mrp.bom.line)
Try to view a BoM with this user
An access error is raised when the system tries to compute the "has_bom" field
Expected behavior
Users with read-only access should be able to view the BoM hierarchy without encountering permission errors.
Additional context
The issue is in the _compute_has_bom method. When computing whether a BoM line has a sub-BoM, the system tries to access information that requires elevated permissions.
Proposed solution
Adding sudo() to the _compute_has_bom method solves the issue by temporarily elevating the permissions for this specific operation:
Module
mrp_bom_hierarchy
Describe the bug
When trying to display a BoM in read-only mode to a user with limited permissions, odoo raises a permission error stating that the user needs write access to mrp.bom.line, even though they're only trying to view the bom.
To Reproduce
Affected versions:
Steps to reproduce the behavior:
Expected behavior
Users with read-only access should be able to view the BoM hierarchy without encountering permission errors.
Additional context
The issue is in the
_compute_has_bom
method. When computing whether a BoM line has a sub-BoM, the system tries to access information that requires elevated permissions.Proposed solution
Adding
sudo()
to the_compute_has_bom
method solves the issue by temporarily elevating the permissions for this specific operation:This allows read-only users to view the BoM hierarchy while maintaining proper security restrictions elsewhere.
The text was updated successfully, but these errors were encountered: