title: on change method in openerp
body: <p>i am trying onchange method programme in openerp using python. but there is no error at the same time there is no response while i change name in field. </p>
  
  <p>xml coding (cus_view.xml)</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;openerp&gt;
  &lt;data&gt;
  
  &lt;!-- ===================== This is tree layout =============================--&gt;
  
  &lt;record model = "ir.ui.view" id = "custom_tree"&gt;
      &lt;field name = "name"&gt;Custom&lt;/field&gt;
      &lt;field name = "model"&gt;cus.custom&lt;/field&gt;
      &lt;field name = "type"&gt;form&lt;/field&gt;
      &lt;field name = "arch1" type = "xml"&gt;
          &lt;tree string = "custom" version = "7.0"&gt;
              &lt;field name = "name"/&gt;
              &lt;field name = "customer_name"/&gt;
              &lt;field name = "customer_street1"/&gt;
              &lt;field name = "customer_street2"/&gt;
              &lt;field name = "customer_city"/&gt;
              &lt;field name = "customer_state"/&gt;
              &lt;field name = "customer_zip"/&gt;
              &lt;field name = "customer_country"/&gt;
              &lt;field name = "customer_mobile"/&gt;
              &lt;field name = "customer_mail"/&gt;
          &lt;/tree&gt;
      &lt;/field&gt;
  &lt;/record&gt;
  
  &lt;!-- ========================This is Form layout===============================--&gt;
  
  &lt;record model = "ir.ui.view" id = "custom_form"&gt;
      &lt;field name = "name"&gt;Custom&lt;/field&gt;
      &lt;field name = "model"&gt;cus.custom&lt;/field&gt;
      &lt;field name = "type"&gt;form&lt;/field&gt;
      &lt;field name = "arch1" type = "xml"&gt;
          &lt;form string = "custom" version = "7.0"&gt;
              &lt;label for = "name" string = "Lab Id"/&gt;
              &lt;field name = "name" style = "width:10%%" /&gt;&lt;br/&gt;
  
              &lt;label for = "customer_name" string = "Customer Name" /&gt;
              &lt;field name = "customer_name" style = "width:10%%" on_change="on_change_customer(customer_name)" /&gt;&lt;br/&gt;
  
              &lt;label for = "Street1" string = "Address"/&gt;
              &lt;field name = "customer_street1" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;field name = "customer_street2" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;field name = "customer_city" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;field name = "customer_state" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;field name = "customer_zip" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;field name = "customer_country" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;label for ="customer_mobile" string = "Mobile"/&gt;
              &lt;field name = "customer_mobile" style = "width:10%%"/&gt;&lt;br/&gt;
              &lt;label for ="customer_mail" string = "Email"/&gt;
              &lt;field name ="customer_mail" style = "width:10%%"/&gt;
          &lt;/form&gt;
      &lt;/field&gt;
  &lt;/record&gt;
  
  &lt;!-- ========================= Action Layout ============================= --&gt;
  
  &lt;record model = "ir.actions.act_window" id = "action_custom"&gt;
      &lt;field name = "name"&gt;Custom&lt;/field&gt;
      &lt;field name = "res_model"&gt;cus.custom&lt;/field&gt;
      &lt;field name = "view_type"&gt;form&lt;/field&gt;
      &lt;field name = "view_mode"&gt;tree,form&lt;/field&gt;
  &lt;/record&gt;
  
  &lt;!-- ===========================Menu Settings=========================== --&gt;
  
  &lt;menuitem name = "Lab Information" id = "menu_cus_custom" action = "action_custom"/&gt;
  
  &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>python coding (cus.py)
      from osv import osv
      from osv import fields</p>
  
  <pre><code>class cus(osv.osv):
  
      _name = "cus.custom"
      _description = "This table is for keeping personal data of student"
      _columns = {
          'name': fields.char('Lab Id',size=64,required=True),
          'customer_name': fields.many2one('res.partner', 'Customer'),
          'customer_street1': fields.char('Street', size=64),
          'customer_street2': fields.char('Street', size=64),
          'customer_city': fields.char('City', size=64),
          'customer_state': fields.char('State', size=64),
          'customer_zip': fields.char('Zip', size=64),
          'customer_country': fields.char('Country', size=64),
          'customer_mobile': fields.char('Mobile', size=64),
          'customer_mail': fields.char('Mail', size=64)
      }
  
  def on_change_customer(self, cr, uid, ids, customer_name, context=None):
      values = {}
      if customer_name:
          cust = self.pool.get('res.partner').browse(cr, uid, customer_name, context=context)
          values = {
              'customer_country': cust.name
          }
      return {'value' : values}
  </code></pre>