Odoo Help

Welcome!

This community 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.

0

Report Parser [Qweb]

By
Samantha Cruz
on 3/3/16, 3:37 AM 504 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>

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

Samantha Cruz
on 3/3/16, 3:39 AM

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"/]
Axel Mendoza
on 3/7/16, 4:14 AM

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 :)

Samantha Cruz
on 3/7/16, 7:59 PM

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 :)

Samantha Cruz
on 3/7/16, 8:00 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/3/16, 3:37 AM
Seen: 504 times
Last updated: 3/3/16, 3:52 AM