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

How to print an empty RML report?

By
Juan Formoso
on 11/3/14, 4:42 AM 851 views

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.(sales@openerp.com)" 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 only the header of the table. 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?

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: 11/3/14, 4:42 AM
Seen: 851 times
Last updated: 3/16/15, 8:10 AM