Help

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

How to get company name in qweb report?

Avatar
Reza

Holaaa, 

I am working on qweb report but i need to get name of my company to show the proper header and footer please help me...

Avatar
Discard
1 Answer
1
Avatar
Best Answer

In your xml, call the template for getting the company name by using the following method:

        <template id="report_session">
            <t t-call="report.html_container">
                <t t-foreach="docs" t-as="doc">
                    <t t-call="report.external_layout">

                         -------------------

                         ------------------------

                          ------------------
                    </t>
                </t>
            </t>
        </template>

In reports/views/layouts.xml:

<template id="external_layout">
    <!-- Multicompany -->
    <t t-if="o and 'company_id' in o">
        <t t-set="company" t-value="o.company_id"></t>
    </t>
    <t t-if="not o or not 'company_id' in o">
        <t t-set="company" t-value="res_company"></t>
    </t>

    <t t-call="report.external_layout_header" />
    <t t-raw="0" />
    <t t-call="report.external_layout_footer" />
</template>

1 Comment
Avatar
Discard
Avatar
Reza
-

thanks it worked for me!