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

Hello,

Is there way to restrict product permission to each user? I would like to give the product permission to user but don't want to access all products. We want user to see only products that we allowed.

Please help me how to restrict this permission.

Thanks

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

Hi,


Yes, you can restrict users to only see specific products in Odoo 15 by using a custom field and record rule:


    Add a Many2many field (e.g. allowed_user_ids) on the product.template or product.product model to assign which users can access each product.

    allowed_user_ids = fields.Many2many('res.users', string='Allowed Users')


    Create a record rule with the following domain:


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


    This ensures users only see products they are explicitly allowed to view, or products with no restriction.


    (Optional) Assign the rule to a specific user group if you only want to apply it to certain users.


With this setup, users will only see products where they are listed in the "Allowed Users" field.


Also you can refer below custom odoo module ,


https://apps.odoo.com/apps/modules/18.0/ace_user_specific_product_allocation


Hope it helps

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

Yes, you can control product each user using bellow odoo modules 

Visit Link: https://apps.odoo.com/apps/modules/18.0/ace_user_specific_product_allocation



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

You can add a field to product model like:
user_ids = fields.Many2many('res.users', 'Users Have Access')

the override read the tree and the form read domains based on users who have access to the product.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 22
3821
3
thg 8 24
6702
3
thg 8 23
4584
1
thg 10 22
3989
2
thg 8 22
3029