I am trying to print a RML report (with no data, just generate the document, to start step by step). But by the moment, I was not able to manage it. I created a new module (res_partner_extended
), and a new model (res.partner.link.category
). In the main folder of my module, I created the file reports.xml
, which indicates the reports I created. This is its code:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="True" id="rpe_rplc_history"
model="res.partner.link.category" name="rpe.rplc_history"
rml="res_partner_extended/report/res_partner_link_category_history.rml"
string="Selected res.partner.link.category (rplc) lines" />
</data>
</openerp>
In the folder reports, I have the next files:
The file with the Python code, rplc_print_history.py
:
from report import report_sxw import time
class res_partner_link_category_history(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(res_partner_link_category_history, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
report_sxw.report_sxw('report.rpe.rplc_history', 'res.partner.link.category',
'addons/res_partner_extended/report/res_partner_link_category.rml',
parser="res_partner_link_category_history", header="external")
The RML report, res_partner_link_category.rml
:
<?xml version="1.0"?>
<document filename="preview_report.pdf">
<template title="Preview Report" author="OpenERP S.A.([email protected])" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<story>
<para>
</para>
</story>
</document>
I only want to select lines of the tree view, click Print, then click Selected res.partner.link.category (rplc) lines, and generate a simple report with no data. But instead of printing the report, I am getting this error:
except_osv: (u"'str' object is not callable", (<type 'exceptions.TypeError'>, TypeError("'str' object is not callable",), <traceback object at 0x7f8844101ab8>))
Can anyone help me, please?