-
-
Notifications
You must be signed in to change notification settings - Fork 912
Description
Due to Contact security restrictions added by this addon, in some situations, restricted users could not save PO lines, when a product with restricted vendor prices are involved. Not sure which the best solution for this could be.
Module
purchase_security
Describe the bug
For a restricted Purchase user (e.g. "See own documents" one), a read access error is raised when a product with seller records is selected, if one of them belongs to a vendor (contact) restricted for the user.
To Reproduce
At least at 17.0, but presumably at other versions as well.
Steps to reproduce the behavior:
- From a Purchase "Manager" user, add a Purchase record (Vendor pricelist) to a product A, for a certain vendor V.
- Ensure that selected Vendor V has a Purchase Representative set.
- From a Purchase "User (own orders)" user that is not vendor V Purchase Representative, open a PO and try to select product A for a new line => a 'read' access error for Contact is raised.
Expected behavior
No error should be raised. Not sure what should Odoo do/select instead.
What should be the proper approach? I've checked that PO line's _suggest_quantity() method (that calls _select_seller() at product module) is the error responsible, so adding here a sudo() could solve it. Other approach should be adding record rules for product.supplierinfo (and hide those that belong to restricted vendors, for this group). Both solutions are not equivalent anyway....