Skip to Content
Menu
This question has been flagged
4891 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)
        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:

<table width="95%" cellpadding="5px" cellpadding="5px">
    <tbody>
      <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>
      </tr> 
    </tbody>
</table>

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

Avatar
Discard
Author

Any suggestions on this please?

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

Related Posts Replies Views Activity
7
Jun 21
16506
0
Mar 15
3836
3
May 18
7221
4
Sep 16
9086
1
Dec 15
4097