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.

1

creating custome report with libreoffice or aeroo

By
MoayadRayyan
on 12/5/14, 7:14 AM 2,863 views

greetings,

im trying to create new reports , but i don't know what is the best way to do it .

am using odoo 8 with ubuntu 12

i tried to add the report designer extension to the libreoffice 3.5 but i get this problem :

python-loader:<trype 'exceptions.importError'>;No module named com.sun.star.lang ,traceback follows couldn't find uno._uno_extract_printable_stacktrace

so i tried other module "Aeroo report " also with problem once i tried to add this module to my odoo

File "/opt/odoo/tierp/addons/report_aeroo/report_aeroo.py", line 38, in <module> from openerp.report.report_sxw import report_sxw, report_rml, browse_record_list ImportError: cannot import name browse_record_list

 

i really need help with this if any one can help me will be appreciated .

 

Best regards

 

2

Hello MoayadRayyan,
Actually there is no way to create a custom report with Aeroo reports nor OpenOffice plugin with Odoo 8 and ubuntu.

  • Aeroo reports needs a python library (uno) which was deprecated and will not work without it, it works fine for pdf but it will not work for xls reports.
  • OpenOffice plugin doesn't work with Odoo 8

For Aeroo reports you will need to install some dependencies which are detailed in the project repository.

But there is a working alternative: 

I personally use this last option + iReport designer and have no complains so far.

Cheers

4
Abdullah Sofan
On 12/6/14, 9:59 AM

@MoayyadRayan,

I have been struggling to figure how to make reports myself just a few days ago. I learned the basics of creating Qweb reports and this is what I have learned so far:

Let's say you want to create a report for your model named : moayad_model. and you want the report to display the fields: field_one and field_two.


1) Inside the folder of "moayad_model" create a new xml file (for example: moayad_report_view.xml) with this xml code in it:

<?xml version="1.0"?>
<openerp>
<data>

<!--#########################################################################
 Section 1: The below section specifies the paper format of the report you want 
 to create and its dimensions and orientation. 
 
##########################################################################--->

<record id="moayyadrayyn_paperformat_euro_lowmargin" model="report.paperformat">
        <field name="name">Moayyad's European A4 low margin</field>
        <field name="default" eval="True" />
        <field name="format">A4</field>
        <field name="page_height">0</field>
        <field name="page_width">0</field>
        <field name="orientation">Portrait</field>
        <field name="margin_top">5</field>
        <field name="margin_bottom">5</field>
        <field name="margin_left">5</field>
        <field name="margin_right">5</field>
        <field name="header_line" eval="False" />
        <field name="header_spacing">0</field>
        <field name="dpi">80</field>
    </record>

<!--#########################################################################
Section 2: In this section you specify the model you are creating this report for. in the
name and file attributes write them in this format:

the folder of your model.the name of the file of your report
 
##########################################################################--->

    <report 
        id="action_moayad_report"
        model="moayadmodel" 
        string="Moayad's Report"
        report_type="qweb-pdf"
        name="moayad_model.moayad_report" 
        file="moayad_model.moayad_report" 
    />
    
    
<!--#########################################################################
Section 3: This is the action record for the report. 
for record "id" use the id of the report you put in section 2 
for "ref" use the id of the paper format you put in section 1
 
##########################################################################--->    

    <record id="action_moayad_report" model="ir.actions.report.xml">
        <field name="paperformat_id" ref="moayyadrayyn_paperformat_euro_lowmargin"/>
    </record>

</data>
</openerp>


2) create another xml file called moayad_report.xml and place it inside your model directory (moayad_model) with the following code in it:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="moayad_report">
            <t t-call="report.html_container">
                <t t-foreach="docs" t-as="o">
                    <div class="col-xs-12">
                        <t t-call="report.external_layout">
                            <div class="page">
                            <!--################Start body of the report in HTML ###########-->
                            <!--################You can use simple HTML to add organize the fields as you wish
                                                them to appear in your report###########-->
                            <h2>Moayad Report Title</h2>
                                <table>
                                    <tr>
                                        <td>
                                                <h5 t-field="o.field_one"/>
                                                <h5 t-field="o.field_two"/>
                                        </td>
                                    </tr>
                                </table>
                            <!--################End body of the report in HTML###########-->
                            </div>
                        </t>
                    </div>
                </t>
            </t>
        </template>
    </data>
</openerp>

3) add both xml files you created to "update_xml" definition of the file  __openerp__.py 

That's it. Now after you install your module, the "print" drop down menu will be available for you to view.

I hope this helps you out. Again, I am just a newbi and I am sure someone here with more expertise would help you even more.

Salam

0
MoayadRayyan
On 12/6/14, 7:32 AM

ok can you please provide any helpfull taturial or links ? google is not that enought yet i can't find help .

0
Mathias Neef
On 12/30/14, 2:33 PM

It is not for Libre-Office or Aeroo, but it is an interesting Tutorial for the actual standard way to create reports in Odoo:
http://blog.emiprotechnologies.com/create-qweb-report-odoo/

 

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: 12/5/14, 7:14 AM
Seen: 2863 times
Last updated: 3/16/15, 8:10 AM