This question has been flagged
2 Replies
3479 Views

from openerp.osv import osv
from openerp.report import report_sxw

class invoice_timesheet_report(report_sxw.rml_parse):
    
    def __init__(self, cr, uid, name, context):
        super(invoice_timesheet_report, self).__init__(cr, uid, name, context=context)

        self.localcontext.update({
            'get_line_detail': self.get_line_detail,

        })
        self.context = context
        self.total_byinvoice = 0.0

    def get_byinvoive_total(self):
        return self.total_byinvoice

in report.xml

<tr class="border-black" style="border-bottom: 1px solid black">
       <td><strong><span t-esc="get_byinvoice_total()" /></strong></td>
</tr>

 

while running report i got an error

.....

....

QWebException: "'NoneType' object is not callable" while evaluating
'get_byinvoice_total()'

 

 

Avatar
Discard

I could have been the mis-spelling: def get_byinvoive_total(self):

Best Answer

Hello Kumar,

The method doesn't called becuse you didn't define get_byinvoice_total() method in localcontext.

Try it again after adding the method in localcontext as follow:

self.localcontext.update({
    'get_line_detail': self.get_line_detail,
    'get_byinvoice_total': self.get_byinvoice_total,
})

Avatar
Discard
Best Answer

try this in __init__ :
self.localcontext.update({
            'get_line_detail': self.get_line_detail,
            'by_invoice_total':self.by_invoice_total,
        })

 

and return some value form that method 

Avatar
Discard