1
votes

My access rule is like mentioned below. I hope its correctly written.

    <record id="supervisor_rule" model="ir.rule">
        <field name="name">Supervisor</field>
        <field name="model_id" ref="supervior_module.model_supervisor_manager"/>
        <field name="domain_force">[('user_id','in',[user.id])]</field>
        <field name="groups" eval="[(4, ref('supervior_module.group_site_supervisor'))]"/>
        <field eval="1" name="perm_unlink"/>
        <field eval="1" name="perm_write"/>
        <field eval="1" name="perm_read"/>
        <field eval="1" name="perm_create"/>
</record>

But issues is, when I run my code it says. Invalid field 'user_id' in leaf.

3

3 Answers

1
votes

First of all check your model supervisor_manager that has user_id If not, than add field and give relationship with res.users After than you need to follow the below code. No longer error will come.

try this,

<record id="supervisor_rule" model="ir.rule">
    <field name="name">Supervisor</field>
    <field name="model_id" ref="supervior_module.model_supervisor_manager"/>
    <field name="domain_force">[('user_id','=',user.id)]</field>
    <field name="groups" eval="[(4, ref('supervior_module.group_site_supervisor'))]"/>
    <field eval="1" name="perm_unlink"/>
    <field eval="1" name="perm_write"/>
    <field eval="1" name="perm_read"/>
    <field eval="1" name="perm_create"/>
</record>
0
votes

Please check you table supervisor_manager have user_id field in it and it related to res_partner table. If not please specify the supervisor field name instead of user_id

0
votes

Check that supervisor.manager model there is a field named "user_id"