Odoo - OpenERP - How to Translate QWeb Report in Odoo 8 ?

| 2 1 2
Asked on 8/15/15, 7:26 AM

When we make any module which will be used in multiple geographical region and will be accessed in multiple languages at that point of time we have to add language support to the module.

In this blog we will see how to add Multi-Language support in QWeb reports of Odoo 8.


Translation is supported by Odoo, but you will be wondering the way odoo used to translate the report based on user language is very easy.

So if you want to make translations and change the report language as which language is set.

Every default report has two QWeb views. One record with the actual report (named report_xxxx_document) and one record with the translation logic (report_xxxx)
In this second record, the report_xxx is where the languages will be fetched:

<?xml version=”1.0″?>
<t t-name=”account.report_invoice”>
<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’, ‘account.report_invoice_document’)”/>

As you can see this second record checks the language from the user with partner_id.lang and then loads the correct translation on report.

So, how do you get the correct languages?
You’ll need to create a new folder named i18n and place a .po file in this for every language you want to translate.

The file should have the ISO language codes. For example for the Dutch language this would be nl.po.

In this file you should add the module name, location of the value you want to translate, the source and the translation.For example:

#. module: sale
#: view:sale.order.line:sale.view_order_line_tree
msgid “Qty”
msgstr “Hvhd”

Simply do this for everything you want to translate, for every language, and then update your module.

Note: You can see examples in any module under the folder i18n. You have to do the same for your module but with other values and module names.

| 2 1 2
Answered on 8/15/15, 7:27 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!

Ask a Question

Keep Informed

About This Forum

This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.

Read Guidelines

Question tools

3 follower(s)


Asked: 8/15/15, 7:26 AM
Seen: 4747 times
Last updated: 8/15/15, 7:27 AM