0
votes

Good day,

I am working on a project, and i have faild to bypass this Record Rule ['|',('company_id','=',False),('company_id', 'in', company_ids)]

What I want to achieve is that If Company A makes a request to Company B for a medical(lab) test request, this request should be available in both Company Lab Request List View. I have a feild called laboratory_id (which is the same as company_id). I am wondering how I can use laboratory_id in a record rule to show both the requests to both Company A & B.

2
You can remove this record rule or added company A and B in setting for your user.You can learn how to write record rule cybrosys.com/blog/record-rules-in-odoo-13Neural

2 Answers

0
votes

You can write your rule like that.

<record id="request_list" model="ir.rule">
        <field name="name">request.rule</field>
        <field name="model_id" ref="your_module.your_model_name"/>
        <field name="domain_force">['|',('laboratory_id','=',False),('laboratory_id', 'in', company_ids)]</field>
        <field name="groups" eval="[(4, ref('base.group_user'))]"/>
    </record>
0
votes

Please re-write the domain as below:

['|','|',('company_id','=',False),('company_id', 'in', company_ids),('laboratory_id', 'in', company_ids)]