Skip to Content
Menu
This question has been flagged
2 Replies
1312 Views

Hello Everyone:

I have a form of Members from which i create members by creating Many2one relation. Now i want to access these members in another. But it showing me all values of res.partner. I only want those members i created, or whose domain or active_id = True?

plz help

here is my onchange:


@api.onchange('member_id')
def _onchange_member(self):
res={}
res['domain']={'member_id':['select member_id from res.partner'
'where active=True']}
but it is not working
Avatar
Discard
Best Answer

hi 
so you have form view of a member, from where you create partner as a member like (customer or supplier) 
I assume that you have already taken `is_member` on partner object and check/tick it for all the partners who are members

Now on other models, you want to display only member partner so should apply domain on a field like below

member_id=fields.many2one('res.partner', domain="[('is_member', '=', True)]")​

Avatar
Discard
Best Answer

which version is this?
now its simple as
just add domain in field declaration like,

member_id=fields.many2one('res.partner', domain=([('active'','=',True)])

Avatar
Discard