Odoo Help

1

Alternative on RML headers in Odoo 8? Should these fields be removed from Odoo 8?

By
Yenthe
on 12/17/14, 2:26 AM 3,117 views

In Odoo 8 when you go to your company settings you can configure the RML header, internal header and internal header for landscape reports.
However RML is outdated and no longer used in quotations, invoices, ...
 

So my question is.. Shouldn't these fields be totally removed from Odoo 8 since they have no more use?
And then the second question is.. how can we now set default headers and footers in Odoo 8 without modifying every QWeb?

With kind regards
Yenthe

Based on my search the following reports are still using RML: ./addons/marketing_campaign_crm_demo/crm_lead_mc_demo_report.rml ./addons/mrp_operations/report/mrp_code_barcode.rml ./addons/mrp_operations/report/mrp_wc_barcode.rml ./openerp/addons/base/report/preview_report.rml ./openerp/addons/base/module/report/ir_module_reference.rml

Ivan
on 12/17/14, 5:13 AM

@Ivan actually, you can see which ones use RML by going to settings > Reports > Reports. The list shows if it is PDF or RML apparently! And indeed those are the .rml files that are left.

Yenthe
on 12/17/14, 5:18 AM
2

Yenthe

--Yenthe--
7130
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 12/17/14, 5:50 AM

Turns out the RML fields under company settings are no longer used for 95% of the reports. As RML is outdated this is no longer a viable option to change a report anymore.
There is, however, a solution. Under addons/report/ are the default templates for your header and footer.

What I personally did to customize my footer is edit the file layouts.xml under /addons/report/views/
The widget under the template with id "external_layout_header" contains the code for filling up the top part.
My code:

<template id="external_layout_header">
    <div class="header">
        <div class="row">
            <div class="col-xs-3">
                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
            </div>
            <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
        </div>
        <div class="row zero_min_height">
            <div class="col-xs-12">
                <div style="border-bottom: 1px solid black;"></div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                <div t-field="company.partner_id" 
                    t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "email", "website",
            "vat"], "no_marker": true}'
                    style="border-bottom: 1px solid black;"/>
            </div>
        </div>
    </div>
</template>

The second thing you need to change is the DPI. Otherwise not everything from your header will fit in. You can do this under settings > Reports > Paper Format or through code in the file report_paperformat.xml under /addons/report/data/
Example of my code:

        <record id="paperformat_euro" model="report.paperformat">
            <field name="name">European A4</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">40</field>
            <field name="margin_bottom">23</field>
            <field name="margin_left">7</field>
            <field name="margin_right">7</field>
            <field name="header_line" eval="False" />
            <field name="header_spacing">35</field>
           <!--Custom, this was 90-->
            <field name="dpi">120</field>
        </record>

Reload your module and you'll get this result:

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

Question tools

3 follower(s)

Stats

Asked: 12/17/14, 2:26 AM
Seen: 3117 times
Last updated: 3/16/15, 8:10 AM