how to limit access rights on Odoo so that salespeople can only access their own account data (such as contacts, discounts, etc.)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
how to limit access rights on Odoo so that salespeople can only access their own account data (such as contacts, discounts, etc.)
Hi,
You can use record rules to achieve this.
eg:
<record id="id_of_record" model="ir.rule">
<field name="name">Record rule name</field>
<field ref="sale.model_sale_order" name="model_id"/>
<field name="domain_force">[('user_
<field name="groups" eval="[(4, ref('module.your_user_group'))
<field name="active" eval="False"/>
</record>
The above shown code is an example of Record rule for only the user to view his own records and also the user should be in the group your_user_group.
We can add this from the front end also.
Go to Settings -> Technical -> Security -> Record Rules and create a rule.
Hope it helps
Hi PT. Simpang Kopi Indonesia,
Please find code in comment.
Hope it will be helpful to you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
Please find Example in comment :-
<record id="res_partner_salesperson" model="ir.rule">
<field name="name">res.partner.salesperson</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="domain_force">[('user_id', '=', user.id)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
</record>
In this record rule, we are checking for currently logged user(user.id) is salesperson in res.partner(customer/Contacts),
Now current logged user will see only that records of customer in which user is selected as salesperson (In res.partner salesperson field name is user_id)
Same this, you can create multiple record rules for different models(Just change reference model and domain).
Example of sale order:
<field name="model_id" ref="sale.model_sale.order"/>
<field name="domain_force">[('user_id', '=', user.id)]</field>
Also in sale order, salesperson field's name is user_id
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Registrarse