COnvert number to letter
<p>i had install module <strong>num2words</strong>
this is my code :</p>

<pre><code>from num2words import num2words
</code></pre>

<p>class HrHolidays(models.Model):
    _inherit = 'hr.holidays'</p>

<pre><code>interim = fields.Many2one(
    'hr.employee',
    string="Interim")
partner_id = fields.Many2one('res.partner', string="Customer")
remaining_leaves = fields.Integer(compute='_get_remaining_days', string='Leaves')  
number_text=fields.Char(string='Nombre de jour')


@api.multi
def _get_remaining_days(self, name, args):
    res = super(HrHolidays, self)._get_remaining_days(name, args)
    return res

def calculatenumber(self, number_of_days_temp,lang='fr'):
    number_text = num2words(number_of_days_temp,lang)
    return {'value': {'number_text': number_text}}
</code></pre>

<p><strong>.xml</strong></p>

<pre><code>             &lt;xpath expr="//field[@name='interim']" position="after"&gt;
                      &lt;field name="number_of_days_temp" nolabel="1"  on_change="calculatenumber(number_of_days_temp)"/&gt;

     &lt;/xpath&gt;
        &lt;field name="number_of_days_temp" position="after"&gt;
            &lt;field name="number_text"/&gt;
        &lt;/field&gt;
</code></pre>

<p>i got this error i dont know how to solve it 
<a href="http://i.stack.imgur.com/dKpsw.png" rel="nofollow"><img src="http://i.stack.imgur.com/dKpsw.png" alt="enter image description here"></a></p>

<p>verify the definition of the function</p>

<pre><code>def calculatenumber(self,cr, uid, ids,number_of_days_temp, context=None):
    number_text = num2words(number_of_days_temp,lang='fr')
    return {'value': {'number_text': number_text}}
</code></pre>

<p>or you can use the new api</p>

<pre><code>@api.onchange('number_of_days_temp')
def calculatenumber(self):
    self.number_text = num2words(self.number_of_days_temp,lang='fr')
</code></pre>

<p>then you must remove  <code>on_change="calculatenumber(number_of_days_temp)"</code> from your XML view</p>

python odoo-8