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 do you specify which language is used in a custom qweb invoice template/report?

By
E.M.
on 9/22/15, 5:43 AM 993 views

I have created a custom QWeb report as invoice template. However I do not know how to specify which language the report should use.

What should be done to specify a given language/translation for the used terms and fields?

Thanks

1

Yenthe

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

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

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

Yenthe
On 9/22/15, 7:51 AM

Hi E.M,

This is specified in the XML file where you've built the report.An example for the quotation report in Odoo:

<template id="report_saleorder"> 
    <t t-call="report.html_container"> 
        <t t-foreach="doc_ids" t-as="doc_id"> 
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"/> 
        </t> 
    </t> 
</template>

That t-raw is telling to get the language from the partner which is filled in on the field partner_id.lang. The report will print in that language, provided it is installed and that there is a translation for the report.

If you don't have the language from some field on the form you can also get it from the 'lang' setting. An example:

<template id="my_custom_report">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'lang', 'aa_maatwerk_wansheng.my_custom_report_document')"/>
</t>
</t>
</template>

Yenthe

Thanks Yenthe. The report actually had the t-raw argument specifing to use partner_id.lang which made me check configured language for the partner, which was English. I did not notice/know that report language depends on partner language (which clearly makes sense).

E.M.
on 9/22/15, 5:51 PM

No problem E.M! And now you know. :) Best of luck.

Yenthe
on 9/23/15, 1:51 AM

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: 9/22/15, 5:43 AM
Seen: 993 times
Last updated: 9/22/15, 5:48 PM