Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am trying to understand how to create a report. In fact, I created a new module with a new model, and I am trying to print just an empty report of this new model. After I manage it, I will fill the report in step by step.
But there is something that I am doing wrong, and I would like that you corrected me. By the moment, these are the steps I think I have to do (check the names I am using, because I think the error is there).
I have to generate a folder called report. Inside it, I have to create a __init__.py file (which includes the python file of the report folder).
- Inside the folder report, I have to create a .py file, for example, print_my_model.py. The code of this file should be the following:
from report import report_sxw
def __init__(self, cr, uid, name, context=None):
super(print_my_model_parser, self).__init__(cr, uid, name, context=context)
- Still inside the report folder, I have to create the RML file with the name specified above, inside the .py (in this case, the name of the RML file must be name_of_the_rml_file.rml). I decided to create a test RML file, with no data, so the code inside is:
<template title="Preview Report" author="OpenERP S.A.(firstname.lastname@example.org)" allowSplitting="20">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- Finally, in the main folder of my module, I have to create a XML file to declarate the reports I want to create (this way, the button Print will be generated automatically in the interface). This XML file must be included in the __openerp__.py file, and its content should be:
<?xml version="1.0" encoding="utf-8"?>
<report auto="True" id="whatever_id"
string="Whatever message to show in the Print button of the interface" />
This is not working. I would like you to correct me, specially just above, where I declare the available reports, because I think I am doing some mistakes. In the id I can write anything I did not use earlier. In name, I think I have to write the name of my module followed by a dot and whatever name I want, but in the .py, when I pass parameters to report_sxw.report_sxw(), the first one must be exactly this name, with report. just before. Is this right? Do you see anything I am doing wrong?
I always get this error when I click the button Print and then mines (Whatever message to show in the Print button of the interface):
except_osv: (u"'str' object is not callable", (<type 'exceptions.TypeError'>, TypeError("'str' object is not callable",), <traceback object at 0x7f8c3cb2c1b8>))
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/3/14, 10:28 AM|
|Seen: 1611 times|
|Last updated: 3/16/15, 8:10 AM|