Skip to Content
Menu
This question has been flagged
3 Replies
2986 Views

what result this expression domain="[('id', 'in', many2many-field[0][2])] will return and what is [0][2] ?

Avatar
Discard
Best Answer

Actually many2many will return a dictionary with three values as below.
[(0, False, [list of ids])]
So we have to specify [0][2] to get the ids of items.

eg:

suppose sale_products  is a M2m field. with values P1, P2,P3
When we print it, It will return [(0, False, [id of p1,id of p2,id of p3])]
so we use [0][2] to get id of p1,id of p2,id of p3 from that field.

Hope it may help you :)

Avatar
Discard
Best Answer

   

Avatar
Discard
Best Answer

why we use M2m[0][2] and not M2m[2] plz can you explain more 

Avatar
Discard