Hello, i want create custom report with my custom renderer, i am using Odoo v9 community. I have error message when generating report:
QWebException: "'NoneType' object is not callable" while evaluating
"translate_doc(doc_id, doc_model, 'partner_id.lang', 'custom_module_name.report_object_review_document')"
my custom_module_name_report.xml:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
string="Object review"
id="action_report_object_review"
model="crm.lead"
report_type="qweb-pdf"
name="custom_module_name.report_object_review"
file="custom_module_name.report_object_review"
/>
</data>
</openerp>
report_object_review.xml:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_object_review_document">
<t t-foreach="docs" t-as="o">
</div>
<div class="page">
<div class="row">
<h3>Title</h3>
<span t-esc="get_format()"/>
</div>
</div>
</t>
</template>
<template id="report_object_review">
<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', 'custom_module_name.report_object_review_document')"/>
</t>
</t>
</template>
</data>
</openerp>
custom_module_name.py
from openerp.osv import osv
from openerp import models, fields, api, _
class report_object_review(models.AbstractModel):
_name = 'report.custom_module_name.report_object_review'
_template = 'custom_module_name.report_object_review'
def get_format(self):
return 'some text!!!'
@api.multi
def render_html(self, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name(self._template)
docargs = {
'get_format': self.get_format,
'doc_ids': self._ids,
'doc_model': report.model,
'docs': self,
}
return report_obj.render(self._template, docargs)
maybe someone can tell me what is wrong with my code?
thank in advance!