コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4718 ビュー

I have a many2one field and I want to show the items in it based on the logged in user's group. I am using odoo-9.

I have written a domain in that rule, but the problem is both the left and right side operands may have multiple values. The following is my code,

<record id="pricelist_visibility" model="ir.rule">

        <field name="name">User can only see orders in his/her Pricelist</field>

        <field name="model_id" ref="product.model_product_pricelist"/>

        <field name="domain_force">[('group_ids.group_id.id','child_of',[user.groups_id.id])]</field>

</record>

アバター
破棄
最善の回答

Hello Sebin,

Sure you can do that, You need to create record rule on m2o relation object, Now that record rule can be global or can be group specific , which handle visibility of the m2o object records.

Bests

アバター
破棄
著作者

Hi Jigar Amin, Thanks for your answer. I also tried to create the record rule but there is problem,

I have written a domain in that rule, the problem is both the left and right side operands may have multiple values. The following is my code,

<record id="pricelist_visibility" model="ir.rule">

<field name="name">User can only see orders in his/her Pricelist</field>

<field name="model_id" ref="product.model_product_pricelist"/>

<field name="domain_force">[('group_ids.group_id.id','child_of',[user.groups_id.id])]</field>

</record>