Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

How to show items in a many2one field based on user group in odoo-9?

By
Sebin Siby
on 6/30/16, 2:04 PM 231 views

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>

0
Jigar Amin (jam)
On 6/30/16, 4:03 PM

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>

Sebin Siby
on 7/1/16, 1:15 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/30/16, 2:04 PM
Seen: 231 times
Last updated: 9/6/16, 9:49 AM