Odoo Help


2 Answers

Axel Mendoza

--Axel Mendoza--
| 8 8 10
Camaguey, كوبا
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
9‏/3‏/2016 2:47 ص

Hi Samantha

Your error is due to this line:

'get_data': self._get_data(voucher), 

because you are getting the result of the _get_data method call and assign it to the localcontext dict. Change it to:

'get_data': self._get_data, 

And you will be ok. The localcontext is were you put some info available to the report and for function calls in the report you need to use the function object reference

Samantha Cruz
7‏/3‏/2016 7:58 م

I can't edit my question.

This is my code (as of now) but it returns an error: 

QWebException: ""'account.voucher.pay.detail' object is not callable" while evaluating
'get_data(o)'" while evaluating


from openerp import models
from openerp.report import report_sxw

class report_parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pdc_report_parser, self).__init__(cr, uid, name, context=context)
active_ids = context.get('active_ids')
account_voucher = self.pool.get('account.voucher')
docs = account_voucher.browse(cr, uid, active_ids, context)

voucher = []
for voucher_id in active_ids:
voucher_id = account_voucher.browse(cr, uid, voucher_id, context)

'docs': docs,
'get_data': self._get_data(voucher),
'hello_world': self._hello,

def _hello(self):
return "Hello World!"

#It returns all ids of the object 'account.voucher.pay.detail' based on voucher_ids that was selected
def _get_data(self, voucher_id):
print "voucher_id:", voucher_id
pay_details = []
account_voucher_pay_detail = self.pool['account.voucher.pay.detail']

for rec in voucher_id:

details = account_voucher_pay_detail.search(self.cr, self.uid,
[('voucher_id', '=', rec.id)])
if details:
pay_details = pay_details + details
pay_details = account_voucher_pay_detail.browse(self.cr, self.uid, pay_details)
return pay_details

class pdc_report_parser_test(models.AbstractModel):
_name = 'report.parser_module.report_test_document'
_inherit = 'report.abstract_report'
_template = 'parser_module.report_test_document'
_wrapped_report_class = report_parser


<?xml version="1.0" encoding="utf-8"?>
<!--Custom report.-->
<template id="report_test_doc">
<t t-call="module_parser.my_layout">
<div class="page">
<table class="table table-condensed">
<th>Transaction Date</th>
<th>Check Date</th>
<th>Check No.</th>
<t t-if="o.partner_id.customer">
<t t-if="o.partner_id.supplier">
<tr t-foreach="get_data(o)" t-as="pd">
<span t-field="o.date"/>
<span t-field="pd.date_due"/>
<span t-field="pd.name"/>
<span t-field="pd.check_no"/>
<span t-field="pd.amount"/>
<span t-field="o.partner_id.name"/>
<template id="report_test_document">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'module_parser.report_test_doc')"/>

In the default, it can print all necessary information but per page (1 voucher, 1 page) not in one page only (all vouchers selected in one page)

1 Comment
Alaa Ahmed
3‏/6‏/2017 5:43 م

i have the same error have you found any solution ??

Ask a Question
Keep Informed
1 follower(s)
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