Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
As far as I can see the access control in Odoo seems to work on record level (
perm_unlink). This is fine for most access control tasks.
However in my module I need access control on field level. The record shall be writeable for the user, i.e. the user must have
perm_write on the record, but some fields shall be read-only for him.
How can this be achieved?
You can do this by inheriting the view for specific group ...
Kindly check these questions:
Create new group by adding new record to res.groups
<record id="group_new" model="res.groups">
<field name="name">Email Notify</field>
<field name="comment">Enable/Disable sending mails</field>
<field name="category_id" ref="module_category_email_id"/>
then use that group in your field,
<field name="Field_Name" groups="your_model.group_new">
then view will not create that element for users which is not in that group. So that is not a view level security. But it will remove your element from view also.
You can use record rules also
<record model="ir.rule" id="ir_custom_access_rule">
<field name="name"> Your Custom Access Right</field>
<field name="model_id" ref="model_your_model"/>
<field name="groups" eval="[ref('your_module.group_new')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="perm_create" eval="False"/>
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/16/16, 5:51 AM|
|Seen: 1679 times|
|Last updated: 2/23/16, 6:30 AM|