Community mailing list archives

community@mail.odoo.com

Re: Record Rules depends on many2many fields?

by
Ludwik Trammer
- 06/24/2015 10:43:31
I think [('section_id', 'in', user.team_ids.ids)] should work for you. ".ids" returns a list of all id numbers in a queryset.

You could also go the other way and write something similar to "[('section_id.member_ids', '=', uid)]".

Ludwik Trammer
http://ludwiktrammer.github.io/

On Wed, Jun 24, 2015 at 9:03 AM Dion Martin <d.m.hamonangan@gmail.com> wrote:
Dear Community,

We are setting up record rules for one of our client. Please give me some advice if you have done same case below:

Sales manager manages more than one sales team. Thus, he should be able to see all Quotations/Sale Orders owned by salesman under his team. We've added new many2many fields on res.users (relation object: crm.case.section)
'team_ids': fields.many2many('crm.case.section', 'sale_member_rel', 'member_id', 'section_id', 'Teams')

So, what is the rule that I have to set on Domain? We've tried these domains with no luck:
[('section_id','child_of',[user.team_ids.id])]
[('section_id','in',[user.team_ids.id])]
[('section_id','=',user.team_ids.id)]

Please share your valuable experiences..

Best regards,
Dion


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe