Call function from another class - field - Odoo v8
<p>I'm struggling with this and I'm not so clear about it.</p>

<p>Let's say I have a function in a class:</p>

<pre><code>class my_class(osv.Model):
    _name = 'my_class'
    _description = 'my description'

    def func (self, cr, uid, ids, name, arg, context=None):
            res = dict((id, 0) for id in ids)
    sur_res_obj = self.pool.get('contratos.user_input')
    for id in ids:
        res[id] = sur_res_obj.search(cr, uid,  # SUPERUSER_ID,
            [('contratos_id', '=', id), ('state', '=', 'done')],
            context=context, count=True)
    return res
    columns = {
        'function': fields.function(_get_func,
        string="Number of completed Contratos", type="integer"),
my_class()
</code></pre>

<p>Now I want to call this very same function from another class-object:</p>

<pre><code>class another_class(osv.Model):
    _inherit = 'my_class'
    _name = 'my_class'

    columns = {
        'another_field' : fields.related('function', 'state', type='char', string = "Related field which calls a function from another object"), 
    }
</code></pre>

<p>But this isn't working, I'm very confused about this, how can I call a function from another object in Odoov8?</p>

<p>I've heard about <code>self.pool.get</code> but I'm not really sure on how to invoke it.</p>

<p>Any ideas?</p>

<p>Thanks in advance!</p>