Skip to content
Snippets Groups Projects
Commit f1706c84 authored by Nans Lefebvre's avatar Nans Lefebvre
Browse files

[FIX] stock: put stored related field product_code in compute_sudo


Have a multi-company setup, with shared products.
Write the default code of a product; an access error is raised on inventory.line

On inventory.line, the field product_code is defined as related to
'product_id.default_code', and stored.
So when writing on the default_code of a product, we get the inventory lines of
other companies. For obvious reasons their access is protected by the record
rule "Inventory Line multi-company", therefore the access error is raised.

To avoid that situation stored related fields should be in compute_sudo.

Note that similarly this is necessary for product_name.
There is one more subtlety: directly writing on the product.product does trigger
the access error, but writing it on the product.template does not.

opw 2007167

closes odoo/odoo#34019

Signed-off-by: default avatarNans Lefebvre (len) <len@odoo.com>
parent a25f6e1b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment