I am creating a module for odoo and I only want the salesman to see the customer that was assigned to him/her in the in contact, so I created a record rule with a domain filter [('user_id,'=' user.id)]:
<record model="ir.rule" id="partner_view_rule_salesperson">
<field name="name">Sales Person View Rule</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]" />
<field name="domain_force">[('user_id', '=', user.id)]</field>
</record>
Now the problem is, the administrator groups seems to be affected by record rule. It throws an error when I create a new user:
The requested operation ("create” on “Contact” (res.partner)) was rejected because of the following rules: - Sales Person View Rule
Records: Sample code {id=18), User: Administrator (id=2)}
I was really confuse because I didn't add the administrator group in the record rule that I've just created. And if I remove the record rule, it returns to normal.
I hope anyone can help me with this. I have already search through the internet and still not able to find the solution for this.
code / error messages
. It would be much better to copy/paste yourcode / error messages
into your question, including what line gives you that error. Please read how to create a Minimal, Complete and Verifiable example. – help-info.de