title: odoo - display name of many2one field combination of 2 fields
body: <p>In my module i have the following many2one field:
  <code>'xx_insurance_type': fields.many2one('xx.insurance.type', string='Insurance')</code></p>
  
  <p>where <code>xx.insurance.type</code> is the following:</p>
  
  <pre><code>class InsuranceType(osv.Model):
      _name='xx.insurance.type'
  
      _columns = {
          'name' : fields.char(size=128, string = 'Name'),
          'sale_ids': fields.one2many('sale.order', 'xx_insurance_type', string = 'Sale orders'),
          'insurance_percentage' : fields.float('Insurance cost in %')
      }
  </code></pre>
  
  <p>I know the many2one field takes the <em>name</em> field as its display name but I would like to have it use the combination of <code>name</code> and <code>insurance_percentage</code> in the form of <code>name + " - " + insurance_percentage + "%"</code></p>
  
  <p>I read it is best to overwrite the <code>get_name</code> method so I tried the following:</p>
  
  <pre><code>def get_name(self,cr, uid, ids, context=None):
      if context is None:
          context = {}
      if isinstance(ids, (int, long)):
          ids = [ids]
  
      res = []
      for record in self.browse(cr, uid, ids, context=context):
           name = record.name
           percentage = record.insurance_percentage
           res.append(record.id, name + " - " + percentage + "%")
      return res
  </code></pre>
  
  <p>and placed this inside the ÌnsuranceType` class.
  Since nothing happened:
  Do i have to place it inside the main class containing the field? If so, is there an other way to do this since that will probably also change the display ways of the other many2one fields?</p>