Search This Blog

Sunday, 16 September 2012

Using 'Child_of' operator In 'Parent-Child Relationship In Search view of Openerp module

If You Want to Search the All child Record Related to that text which had Written on Search Box..

follow the Following Step..

1)  That module must have a parent field in that form view When ever you crating Record for Any objects..

for eg.

If you want to search all semester which are belong /child to that semester which you had wrote in search menu..


module

class standard_standard(osv.osv)

name = 'standard.standard'

columns = {
                  'name':fields('sem',char=64),
                  parent_id.fields.many2one('standard.standard',"Parent Semester"),
}

standard_standard()




You have used that moudle as semster in you student profile

standard_id =fields.many2one ('standard.standard',Semester)



Now only one thing you have to set on you search view

<field name="standard_id" operator="child_of" />

Thats It.

Now you can easily get  you all record belong to that parent which had selected at creation of record.

Thank you