Hello everyone,
I developed a simple custom module which has three fields:
start_date=fields.Datetime(string="Start Date")
end_date=fields.Datetime(string="End Date")
current_user = fields.Many2one('res.users', 'Current User', default=lambda self: self.env.user)
I want for this model that every user can read/write/create/unlink all his records, while he can only read other people's records.
I create these two rules in security.xml
id="user_group_tout" model="ir.rule">
name="name">Change his own info
name="model_id" ref="model_lab_calendar"/>
name="domain_force">[('current_user.id', '=', user.id)]
name="perm_read" eval="True"/>
name="perm_write" eval="True"/>
name="perm_create" eval="True"/>
name="perm_unlink" eval="True"/>
id="read_tout" model="ir.rule">
name="name">Read all
name="model_id" ref="model_lab_calendar"/>
name="domain_force">[('current_user.id', '!=', user.id)]
name="perm_read" eval="True"/>
name="perm_write" eval="False"/>
name="perm_create" eval="True"/>
name="perm_unlink" eval="False"/>
Thank you for your help