How do I fix this error “TypeError: 'Undefined' object is not callable” in openerp 7 webkit report?-Collection of common programming errors
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)
self.localcontext.update({
'time': time,
'cr':cr,
'uid': uid,
'amount_to_text': amount_to_text,
})
report_sxw.report_sxw('report.tax.receipt',
'account.bank.statement.line',
'addons/account_financial_report_webkit/report/webkit_html_bank_statement.mako',
parser=tax_receipt)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
The excerpt from the mako file looks like this:
The sum of | **${ amount_to_text(inv.amount) }** |
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
${ amount_to_text(inv.amount) }
TypeError: 'Undefined' object is not callable
Thank you.
Originally posted 2013-11-09 21:07:14.