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 register a report (store it in the sever) without passing by the LibreOffice plug-in ?

By
Sathors
on 8/8/14, 6:13 PM 659 views

How the title states I'm trying to create custom reports with openerp v7.

I have read all the documentation I have found on the subject, and using the base_report_designer module and libreoffice plugin, I can register my custom report all right, using the "Send to server" command of the plugin.

The thing is, I don't want to do that to register my report. I want to register it directly from the code (store it on the server), so that when I update my module containing the report, the report gets registered automatically, without having to pass by all the hassle of using the plug-in and stuff. Because as far as I understand it, registering through the LO plugin, I will have to do it every time I will install my module in an other database.
I also think I will switch to writing directly the rml file later, without using a Writer template.

So that you may have further information, I created a parser for the report, declaring it at the end of the file using the line : report_sxw.report_sxw('report.sale.collection_docket', 'sale.order', 'addons/module/report/collection_docket.rml', parser=order, header="external")

I have declared the report in a report.xml file, with the following tag :

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report auto="False" id="collection_docket" model="sale.order" name="sale.collection_docket" rml="module/report/collection_docket.rml" string="Collection Docket" />
    </data>
</openerp>

The report.xml is called in the __openerp__.py file, the __init__.py imports everything all right.

But I never see my report in the Settings/Technical/Actions/Reports, so I can't call it.

The thing I don't really understand so far, is how does it work in the bulit-in openerp addons ? How do they get them to register ? I looked at many examples (in addons/stock for example), and I can't stop a difference with my code. So why can't I get the same result in my custom module ?

Thank you for your help, more or less difficult to work on reports because of the lack of official documentation (the one in odoo website is incomplete, and is aimed at v6.1).

Thanks Ben for your answer, but would you have a link on your solution using xmlrpc ? The thing is that I don't only have this problem on updating, but as well for the first registering of the report. The other thing that I don't get is that if its registered as a service as you state, I guess there is a way to emulate what's doing OpenERP for its built-in modules, and get them to register for a custom module like it does for the Sale extension for example.

Sathors
on 8/11/14, 10:26 AM
0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 8/9/14, 1:30 AM

I have the same problem with you. When I check it I use OpenERP 6.1, but I think this behaviour is still persist in OpenERP 7.0. After I dive in the code, I come to conclusion that you can't update rml from module definition by updating the module if the rml already in the database (the module already installed).

I think the issue is because report (sxw/rml) is registered as a service, so the update mechanism is separated from update/init module.

My solution is to update rml content in the database via xmlrpc.
 

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: 8/8/14, 6:13 PM
Seen: 659 times
Last updated: 3/16/15, 8:10 AM