Thursday 28 January 2016

How to make the onchange function in OpenERP(Odoo) ?


openerp.jpeg
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 :
  1. def onchange_function(self, cr, uid,ids,qualification, context=None):
  2.       print"=====qualification======",qualification
  3.       if qualification=='a1':
  4.           a1 = 'Shiva1'
  5.       elif qualification=='a2':
  6.           a2 = 'Shiva2'
  7.       else:
  8.           a3 = 'shiva3'
  9.       print"=====a1====",a1
  10.       obj = self.pool.get('hr.role1').search(cr ,uid ,[('name','=',a1)])
  11.       print"=====obj====",obj
  12.       a2 = self.pool.get('hr.role1').browse(cr, uid, obj, context)
  13.       for val in a2:
  14.           print"=====a2====",val,val.id

  15.           values = {

Here is not the end.Explore more about How to make the onchange function in OpenERP(Odoo) ? at Findnerd.

No comments:

Post a Comment