Skip to Content
Menu
This question has been flagged
4515 Views

I did some research about report parser but I don't know why my module is not working.

The method get_rec is not callable:


report_parser.py

from openerp import models

from openerp.report import report_sxw

import time


class report_parser(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):

super(report_parser, self).__init__(cr, uid, name, context=context)

ids = context.get('active_ids')

account_voucher = self.env['account.voucher']

amount = {}

for partner in account_voucher.browse(ids):

amount[partner.id] = self._get_rec(partner)

self.localcontext.update({

'time': time,

'get_rec': self._get_rec,

})

self.context = context

def _get_rec(self, partner):

account_voucher = self.env[''account.voucher.pay.detail'']

account = account_voucher.search(self.cr, self.uid,

[('partner_id', '=', partner.id)])

movelines = account_voucher.browse(self.cr, self.uid, account)

return movelines

class pdc_report_parser_test(models.AbstractModel):

_name = 'report.my_module.report_test'

_inherit = 'report.abstract_report'

_template = 'my_module.report_test'

_wrapped_report_class = report_parser


report_test.xml


<?xml version="1.0" encoding="utf-8"?>

<!--Custom report.-->

<openerp>

<data>

<template id="report_test">

<t t-call="my_module.mylayout">

<div class="page">

<table class="table table-condensed">

<thead>

<tr>

<th>Transaction Date</th>

                           ... ....

                     </tr>

</thead>

<tr t-foreach="get_rec(o)" t-as="line">

<td>

<span t-field="line.name"/>

</td>

                     ........

</data>

</openerp>

Avatar
Discard
Author

QWebException: ""'NoneType' object is not callable" while evaluating - I always got this error

how did you define the report? Something like this?

[report id="report_test_id" model="your.model" string="Report Test" report_type="qweb-pdf" name="my_module.report_test" menu="True"/]
Author

Thanks for the response Sir, to answer your question - Yes Sir. Anyway, I created a new question, please refer to this link. https://www.odoo.com/es_ES/forum/ayuda-1/question/batch-report-using-report-parser-98789 Thanks Sir :)

Author

Thanks for the response Sir, to answer your question - Yes Sir. Anyway, I created a new question, please refer to this link. https://www.odoo.com/es_ES/forum/ayuda-1/question/batch-report-using-report-parser-98789 Your suggestions will be highly appreciated :)

Related Posts Replies Views Activity
2
Dec 18
13435
1
Mar 16
10463
4
Nov 24
5236
1
Mar 24
398
3
Sep 23
22656