Odoo Help


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.


Translate QWeb Report in Odoo 8

sameer alhwety
on 1/12/15, 5:44 AM 3,419 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



| 7 7 8
Turnhout, Belgium

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
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 .. :)

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

3 follower(s)


Asked: 1/12/15, 5:44 AM
Seen: 3419 times
Last updated: 2/20/16, 2:56 AM