inherited function odoo python
<p>i  want to inherit function in module 'hr_holidays' that calculate remaining leaves the function is :</p>

<h2>hr_holiday.py:</h2>

<pre><code>def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
    cr.execute("""SELECT
            sum(h.number_of_days) as days,
            h.employee_id
        from
            hr_holidays h
            join hr_holidays_status s on (s.id=h.holiday_status_id)
        where
            h.state='validate' and
            s.limit=False and
            h.employee_id in %s
        group by h.employee_id""", (tuple(ids),))
    res = cr.dictfetchall()
    remaining = {}
    for r in res:
        remaining[r['employee_id']] = r['days']
    for employee_id in ids:
        if not remaining.get(employee_id):
            remaining[employee_id] = 0.0
    return remaining
</code></pre>

<p>i had create my own module that inherited to <code>hr_holidays</code> and try this code to inherit but it isnt work </p>

<hr>

<p>myclass.py</p>

<pre><code>class HrHolidays(models.Model):
    _inherit = 'hr.holidays'

    interim = fields.Many2one(
        'hr.employee',
        string="Interim")
    partner_id = fields.Many2one('res.partner', string="Customer")
    remaining_leaves = fields.Char(string='Leaves remaining')


    def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
        res = super(hr_holidays,self)._get_remaining_days(cr, uid, ids, name, args, context)
        return res
</code></pre>

<hr>

<p>please help me </p>

<p>thanks for all , 
but i got problem in the field ,i want to award my function to my field i have done that but isn't work :</p>

<pre><code>    remaining_leaves = fields.Function(_get_remaining_days,string='Leaves')
</code></pre>

<p>i got this error
<a href="http://i.stack.imgur.com/acICN.png" rel="nofollow"><img src="http://i.stack.imgur.com/acICN.png" alt="enter image description here"></a></p>

python openerp