Odoo/OpenERP: How can i restrict a user to his own journal entries -
i want restrict user can see own journal entries, make edits own entries etc. how can this. tried not achieve this.
create res.group
, user belong to.
have give group access in ir.model.access.csv
security file.
define ir.rule
attribute domain_force
takes python coded condition, setting permissions.
this:
<record id="user_see_its_own" model="ir.rule"> <field name="name">user can see own records</field> <field name="model_id" ref="< your_model >"/> <field name="groups" eval="[(4, ref('*<your_group>*'))]"/> <field name="perm_read" eval="1"/> <field name="perm_write" eval="1"/> <field name="perm_create" eval="1"/> <field name="perm_unlink" eval="0"/> <field name="domain_force"> [('create_uid', '=', user.id)] </field> </record>
and you're done.
remember, if have other groups above particular one, have nullify ir.rule
created defining 1 true condition.
this:
<record id="manager_see_all" model="ir.rule"> <field name="name">manager see all</field> <field name="model_id" ref="< your_model >"/> <field name="groups" eval="[(4, ref('*<your_group>*'))]"/> <field name="perm_read" eval="1"/> <field name="perm_write" eval="1"/> <field name="perm_create" eval="1"/> <field name="perm_unlink" eval="1"/> <field name="domain_force"> [(1, '=', 1)] </field> </record>
Comments
Post a Comment