Odoo Help


TypeError: 'Undefined' object is not callable

on 1/15/14, 5:51 AM 4,626 views

my report.py

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

 class iec_account_report_webkit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
    super(iec_account_report_webkit, self).__init__(cr, uid, name, context=context)
        'get_iec_accounts': self._get_iec_accounts,
        'time': time,
        'uid': uid,

def _get_iec_accounts(self, obj):

     payslip_line = self.pool.get('account_move_line')
     payslip_lines = []  
     res = []
     self.cr.execute("SELECT pl.account_id "\
                    "pl.sum(debit) as debit"\
                    "pl.sum(credit) as credit"\
                    " from account_move_line as pl"\
                    "WHERE (date_from >= %s) AND (date_to <= %s)"\
                    "ORDER BY pl.account_id",
                    (self.date_from, self.date_to))
     payslip_lines = [x[0] for x in self.cr.fetchall()]
     for line in payslip_line.browse(self.cr, self.uid, payslip_lines):
            'name': line.account_id.name

     return res

                  '/addons/iec_report_account/report/iec_report_webkit.mako', parser=iec_account_report_webkit)
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

my mako template:

 <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<style type="text/css">

%for o in objects:
<table  width="100%">
            <td style="text-align:center;">
                <h3><b> Mako </b></h3>

 <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">  
        <td width="60%">
            ${_('Account Name') }
        <td width="10%">
            ${_('Debit') }
        <td width="10%">
            ${_('Credit') }

    %for account in (get_iec_accounts(o)):

            <td width="60%" >${account['name']}</td>
            <td width="10%" style="text-align:right;">${account['debit']}</td>
            <td width="10%" style="text-align:right;">${account['credit']}</td>


when i print show this error:

 Webkit render!

     Traceback (most recent call last):
    File "C:\Program Files (x86)\OpenERP 7.0-20131206-         002433\Server\server\openerp\addons\report_webkit\webkit_report.py", line 273, 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:0x36872f0", line 34, in render_body
   %for account in (get_iec_accounts(o)):
  TypeError: 'Undefined' object is not callable

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 1/17/14, 5:03 PM


Use %for account in get_iec_accounts(o):

I believe you even need not to pass any arg as you don't use in method!


pales help me, how can i pass arg to my method. i want to make report by range date

on 1/17/14, 6:09 PM

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

0 follower(s)


Asked: 1/15/14, 5:51 AM
Seen: 4626 times
Last updated: 3/16/15, 8:10 AM