[18.0][product_cost_security] Unable to change picked on stock move without product cost read rights
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- authorization, backend
Research direction
Start with the product_cost_security module and the line that reads self.product_id.standard_price while computing the amount for a stock move line's picked change. Reproduce as a user without product cost read rights, with project_stock_account installed and analytic costs enabled on the operation type. Done means saving picked succeeds for that user without an AccessError, and the cost is still computed correctly. The issue links OCA issue 2115 as a precedent for the sudo and cache approach.
Written by the indexing model from the issue text.
Description
Module
product_cost_security
Describe the bug
The module prevents changin boolean field "picked" on stock.move.line when installed for users without read access to product cost fields. Inventory users should be able to change field "picked" on stock.move even if they are not allowed to see product costs.
amount = - unit_amount * self.product_id.standard_price
Since standard_price requires read access on the product cost, this raises an AccessError for users without required rights when product_cost_security is installed.
It seems that this call should likely use sudo() and price saved in cache as it was resolved in issue https://github.com/OCA/product-attribute/issues/2115
However, i am not sure if any other change should be made along this.
To Reproduce
Affected versions: 18.0.1.0.0
Steps to reproduce the behavior:
- Start new odoo18 database
- Login as admin
- Install modules: project_stock_account, product_cost_security
- Give admin user permission for Analytic Accounting
- Activate developer mode
- Enable Analytic Costs on operation type
- Create/edit stock.picking with operation type from previous step and add project
- In stock.picking lines, select "picked" field to be shown
- In stock.picking lines, change boolean field "picked" and save document
Result:
Saving "picked" field fails with an access error when reading product_id.standard_price.
Expected behavior
Changing boolean field "picked" on stock move should succeed for users without product cost access rights. The module should not block standard stock operations.
- Dominant language
- HTML
- Stars
- 250
- Forks
- 867
- Avg merge
- 9d 2h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OCA/product-attribute
-
[17.0][18.0] product_assortment: Assortments are not assigned to newly created partnersPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
OCA/product-attribute#2460 · 1 comment ·
Maintainers usually reply within 1 day
-
[19.0] Reference when importing productPossibly taken @parabol123654 claimed this today. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
OCA/product-attribute#2505 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 50/100
OCA/product-attribute#2504 · 1 comment ·
Maintainers usually reply within 1 day
-
help wanted no stale work in progress
Difficulty 4/5 Over a week Newbie friendliness 22/100
OCA/product-attribute#2426 · 6 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 35/100
OCA/product-attribute#2365 ·
Maintainers usually reply within 1 day
All issues in OCA/product-attribute
Similar issues
-
add entry to blockOpen
Difficulty 1/5 Under an hour Newbie friendliness 65/100
StevenBlack/hosts#3299 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area-database area-security bug p1-recommended
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ossf/pvtr-github-repo-scanner#539 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
natemoo-re/ultrahtml#102 ·