In onchange function first we have to go in .py file (python file)
After that we have to decide where you want to give onchange function and then give attribute on_change to that field.
Like below python code in py file :
- def onchange_function(self, cr, uid,ids,qualification, context=None):
- print"=====qualification======",qualification
- if qualification=='a1':
- a1 = 'Shiva1'
- elif qualification=='a2':
- a2 = 'Shiva2'
- else:
- a3 = 'shiva3'
- print"=====a1====",a1
- obj = self.pool.get('hr.role1').search(cr ,uid ,[('name','=',a1)])
- print"=====obj====",obj
- a2 = self.pool.get('hr.role1').browse(cr, uid, obj, context)
- for val in a2:
- print"=====a2====",val,val.id
- values = {
Here is not the end.Explore more about How to make the onchange function in OpenERP(Odoo) ? at Findnerd.