Search code examples
xmlodooodoo-12

Expected Singleton error trying to domain using company id in ir.rule


Hi I want to filter my kanban view using company id but I want my super admin to not be affected by that domain here's what i have tried so far

<record id="sample_ir_rule_by_company" model="ir.rule">
            <field name="name">Sample</field>
            <field name="model_id" ref="model_my_model"/>
            <field name="domain_force">[('company_id','in',[user.company_ids.id])]</field>
        </record>

my problem is I'm getting a ValueError: <class 'ValueError'>: "Expected singleton: res.company(2, 1)" while evaluating


Solution

  • What about using ids instead?

    <field name="domain_force">[('company_id','in',user.company_ids.ids)]</field>