Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4039 Lượt xem

I have a multi-company setup where odoo users are users of the mother.

I can create aproduct for mother (which I am a user of) but when I want to create a product for the child-company I get an acces error that says

Access Denied

The requested operation cannot be completed due to security restrictions. Please contact your system administrator.

(Document type: Product Template, Operation: write)

 

  • The child company is marked in the "allowed Companies" tags in >Settings>Users>my_user
  • "Multi Companies" is marked active in >Settings>Users>Usability ...
  • I am set up as manager in Warehouse, Sales, Purchases

any idea what the problem might be?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Probably you have to fix the multi-company rule for products. Go to Settings>Technical>Security>Record Rules and find the rule named = Product multi-company. The default rule was wrong. So you change :

['|',('company_id','=',user.company_id.id),('company_id','=',False)]

for

['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]

Ảnh đại diện
Huỷ bỏ
Tác giả

not willingly. I also wouldn't know how to do that, nor can I find any entries as the one you posted here. The only thing I can relate to is "yes, there is a Model called "ir.rule" which has a filed company_id .... but that's about it. No idea beyond that. Can you be a little more specific about what you mean exactly by your answer (in a way that someone with no knowlaedge in coding nor python might be able to follow) I have a module installed that adds functionality to Multi-Company Setup [https://github.com/vrms/odoo_multi_company_extend] though, but I doubt that it takes away any default features.

Answer updated.

Tác giả

thanks, that actually works. But ... I assume as soon I pull any updates from github now I am going to run into a conflict, wouldn't I? Also this seems to be a bug, so the best way would be to fix the bug in the official code I guess ... Can you tell me where this rule could be found in the actual code? Than I might be able to try and open an issue on github/odoo/odoo, fix this problem and make a PR. Also I saw about 90% of the rules realted to multi-company are the same. I guess the same kind of problem might occur with those as well, right?

Tác giả

do you think altering the 'faulty line' in /addons/product/security/product_security.xml would fix this on a code level? https://raw.githubusercontent.com/vrms/OCB/fix-multi-company-product-issue/addons/product/security/product_security.xml

Tác giả

tried to change the code in the product_security.xml but that doesn't fix the problem. If I look into the "Product multi-company" rule after I changed the xml code there is still the old code shown .

1) security code - note that sources has flag noupdate="1" 2) odoo_multi_company_extend work correctly? without other issues? hmm..I doubt 3) definitions ir.rule rather, it is not a mistake to report as an issue on github/odoo/odoo, strongly depends on the need, they may be different (I have several installations with different settings)