oddo can't adapt type 'hr.employee'
<p>I want to get value of field in my class that one2many to hr_employee:</p>

<pre><code>class cashadvance(osv.osv):
    def get_employeeid(self, cr, uid, context=None):
        idemployee = ""
        employee_id = ""
        ids = self.search(cr, uid, [], context=context) # you probably want to search for all the records
        for adv in self.browse(cr, uid, ids, context=context):
            employee_id = adv.id_employee
        if (employee_id is None):
            idemployee = 0
        else:
            idemployee = employee_id
        return idemployee
    _name = 'comben.cashadvance'
    _columns = {
        'id_employee'               : fields.many2one('hr.employee', string='Employee', required=True, readonly=True),
    }
</code></pre>

<p>it raised error : can't adapt type 'hr.employee' </p>

<p>but when I changed :</p>

<pre><code>class cashadvance(osv.osv):
    def get_employeeid(self, cr, uid, context=None):
        idemployee = ""
        employee_id = ""
        ids = self.search(cr, uid, [], context=context) # you probably want to search for all the records
        for adv in self.browse(cr, uid, ids, context=context):
            employee_id = adv.id_employee
        if (employee_id is None):
            idemployee = 0
        else:
            **idemployee = 1348  #employee_id**
        return idemployee
    _name = 'comben.cashadvance'
    _columns = {
        'id_employee'               : fields.many2one('hr.employee', string='Employee', required=True, readonly=True),
    }
</code></pre>

<p>I worked fine, what I'm doing wrong with this, please help</p>