0
votes

I have a multi-company setup in Odoo, and I would like to limit the products that each user (under the group "User") can access (read/write/create/delete) to the products assigned to the company that the user is assigned to.

To be clear, I have:

Companies:

  • Company A
  • Company B

Users:

  • User A (assigned to "Company A" and user group "User")
  • User B (assigned to "Company B" and user group "User")

Products:

  • Product A (assigned to "Company A")
  • Product B (assigned to "Company B")

With the default setup, User A has access to both Product A and Product B, and I would like user A to have access exclusively to product A, on all modules (Sales, Inventory, POS…)

I believe that is possible to accomplish using Record Rules, but I haven't been able to do it.

3
How did you create your companies...is company B a sub-company of A..because by default a user from another company who doesn't have access to company A for example can't see the product of company A...tell us more about your current setupdanidee
@danidee Company B is not a sub-company of A (nor is Company B a sub-company of A), and User B can also see products from Company A. I assigned the company to each user in both "Allowed companies" and "Current Company" under "Edit user", and neither has the "Multi Companies" setting activated. What else could I check?Rodrigo Escandón Cesarman

3 Answers

1
votes

I got the answer I needed from Jerome Guerriat at the the Odoo forums. I only needed to tick a checkbox under the general settings page:

There already is a product.product multicompany rule (but it is inactive by default): "Product multi-company"

xml id: product.product_comp_rule

You can active it by going to settings => general settings. Check "manage multi company", then uncheck "share product to all companies"

link here: https://www.odoo.com/es_ES/forum/ayuda-1/question/limit-products-to-company-assigned-to-user-in-multi-company-odoo-9-102686

0
votes

Odoo's record rules are the way to do it, as you mentioned it by yourself. For example look at the rule for sales order (sale.order). It's global (no group selected/assigned) and it's restricted to companies:

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

Now create your own record rules for product.template and product.product like the example under Settings/Technical/Security/Record Rules (in Odoo V9 you'll need developer mode to see this) or within a custom module.

0
votes

Odoo Can manage share partner and product without add rules:

  1. Use multiple company
  2. Don`t forget add parent company at Settings > Users> companies (choose child company)
  3. Uncheck Share partner to all companies and Share product to all companies at Settings > General Settings > Shared resources

So, Difference company can`t read product.....