Odoo Help


How do I use amount_to_text function in v7?

Ademola Oke
on 5/29/13, 6:27 PM 1,891 views

Hi everyone,

I've tried everything I know with the amount_to_text function in a webkit report but I'm simply getting nowhere. I've looked at the check writing module and duplicated it as much as I can but still no results. I'm using webkit instead of rml and I'm not sure if this makes a difference in v7 because the same code works fine in 6.1. Any help would be hugely appreciated

This is the code from the .py file:

import time
from report import report_sxw
from osv import osv     
from openerp.osv import osv,fields
from openerp.tools.translate import _
from openerp.tools.amount_to_text_en import amount_to_text

class tax_receipt(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(tax_receipt, self).__init__(cr, uid, name, context=context)
            'time': time,
            'uid': uid,
            'amount_to_text': amount_to_text,


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

The excerpt from the mako file looks like this:

<table width="95%" cellpadding="5px" cellpadding="5px">
      <tr style="text-align:left;border-bottom:1px solid;">
        <td width="10%">The sum of </td>
        <td width="80%" style="text-align:left;border-bottom:1px solid;">**${ amount_to_text(inv.amount) }**</td>

when I try to generate the report, I get:

Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\report_webkit\webkit_report.py", line 266, in create_single_pdf

File "mako\template.pyc", line 302, in render

File "mako\runtime.pyc", line 660, in _render

File "mako\runtime.pyc", line 692, in _render_context

File "mako\runtime.pyc", line 718, in _exec_template

File "memory:0x4a2d6d0", line 78, in render_body
<td width="80%" style="text-align:left;border-bottom:1px solid;">${ amount_to_text(inv.amount,"Euro") }</td>
TypeError: 'Undefined' object is not callable

Thank you

Any suggestions on this please?

Bam Technologies Limited, Ademola Oke
on 6/2/13, 4:28 AM

Hello Faiyer, can you post the corresponding xml report and how you have defined it?

Paul Catinean
on 9/18/13, 7:30 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/29/13, 6:27 PM
Seen: 1891 times
Last updated: 3/16/15, 8:10 AM