Odoo Help


Translate QWeb Report in Odoo 8

sameer alhwety
on 1/12/15, 5:44 AM 6,751 views

Hello ,

I have desigen custome report in odoo version 8 .

I know the translation is supported , but i wonder the way to translate the report based on user language ?

How can i implement the translate ?

Any idea will be helpful



| 8 8 8

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

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

On 1/12/15, 6:50 AM

Hi Sameer

So if I understand correctly you want to make translations and change the report language as which language is set?
Every default report has two QWeb views. One 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')"/> </t>         </t>

As you can see this second record checks the language from the user with partner_id.lang and then loads the correct translation.
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 modulename, 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.

Best of luck

I have add the translate template , and add the translation file ar_SY.po in i18n folder . I add the translation as : #. module: mymodulename #: view:website:mymodulename.myfilename msgid "Arabic" msgstr "عربي" but not translate ? where is the wrong code ?

sameer alhwety
on 1/12/15, 7:01 AM

Have you updated your whole module? I assume that you've replaced mymodulename with your name and that you added it under i18n. Is the language for ar_SY.po also installed on the system and set for the customer / person where you want to have the translation shown?

on 1/12/15, 7:41 AM

Yes [Updated] , I do all thing you have mentioned it in your answer , but with no changes in result . report not translated yet

sameer alhwety
on 1/12/15, 9:25 AM

https://www.dropbox.com/s/fb71bu9ez2kc1wm/test_module.zip?dl=0 this test module for everything you mentioned above .... Not Work ..

sameer alhwety
on 1/12/15, 9:47 AM
On 12/5/16, 2:02 PM

Is there a way to translate the hr.expense report to the language of the customer mentionned in teh analytic account? I've tried to achieve this for a while on odoo 9 community, but it didnt work out yet

Dasadiya Chaitanya
On 2/20/15, 8:30 AM

Just see for the reference in sale module in the ODOO 8.0 

translate the report of  sale order  for  your selected langaage.


I hope this should helpful for you .. :)

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.


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)


Asked: 1/12/15, 5:44 AM
Seen: 6751 times
Last updated: 12/5/16, 2:02 PM