I am modifying hr_payslip report in custom module. I want to add a custom method to this report for this I need to update localcontext with custom method for this report. I am trying
class payslip_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payslip_report, self).__init__(cr, uid, name, context)
self.localcontext.update({
'get_payslip_total':self.get_payslip_total,
})
def get_payslip_total(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
res = []
total = 0.0
for id in range(len(obj)):
if obj[id].appears_on_payslip is True:
total = total + obj.totalreturn total
and calling in qweb template like
<td><span t-esc="get_payslip_total(o.line_ids)"/> </td>
but getting error "QWebException: "'NoneType' object is not callable" while evaluating
'get_payslip_lines(o.line_ids)". Can anyone help me what I am missing here?
Hi, I've you solved your issue?
No
I'm also stuck with this. Just trying to reuse the parser for a new qweb report and it doesn't seems to be possible...
I also got stuck and had to pause the task , if you get solution please post the answer it will help me and others. I have to start that task again in 3-4 days.
i've maybe go a solution for my case... and I think that for your case you will need to override payslip_report instead of report_sxw.rml_parse with something like : class payslip_report(payslip_report): and importing previously the payslip_report with someting like import addons.hr_payroll.report.report_payslip hope this help
try this, https://www.odoo.com/forum/help-1/question/how-output-a-odoo-8-datetime-field-without-time-on-a-qweb-report-67948#answer-67995
Did you solve this post? I have the same.