1 答案
Hi,
I tried your code and no records were visible in the tree view. Hope you have the same issue.
Now, you can achieve your requirement: read & create to all records and all access to self records, by adding the group in the rule. When I added the access right for the model 'lab.calendar' I have given all permissions to the Internal Users Group(base.group_user) in the CSV file. So, I have added the same group in the rule. If you have used any custom group to set access rights for this model, use that group in the rule replacing the 'base.group_user'.
<record id="lab_calendar_rule_self_record" model="ir.rule">
<field name="name">Change his own info</field>
<field name="model_id" ref="model_lab_calendar"/>
<field name="domain_force">[('current_user.id', '=', user.id)]</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
<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>
<record id="lab_calendar_rule_other_record" model="ir.rule">
<field name="name">Read all</field>
<field name="model_id" ref="model_lab_calendar"/>
<field name="domain_force">[('current_user.id', '!=', user.id)]</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="False"/>
</record>
Regards