Hi guys,
In this tutorial I will learn you how to translate (custom) Odoo reports.
In quite a lot of cases translations do not work on reports or they’re not yet translated by the community.You can fix this easily on your own Odoo though!
The trick to have translations always match up with the reports is to get the correct module name and the correct record ID. So lets get started!
1. Getting the technical details
First of all search the QWeb report you wish to translate by going to settings > Reports > Reports. Search the report you wish to translate for in the list and open it up. In this example I will do this with the quotations report since translations aren’t correct in my language there.
When you’ve found the report you want to translate on (in this case Quotation / Order) and click on it you’ll get this view:
There is a clickable link named ‘Search associated QWeb views’, click on it. You will now get a new view which shows you the two XML records that are used to build this report. The top one is irrelevant and is used for loading translations so click on the second one ‘report_saleorder_document’. You always need the item that is named xxx_document.
Now that you’ve opened up this view you will see there are a lot of technical details here! There is an item named ‘Model Data’ with a clickable link right next to it. Click on this one.
You will now get this screen:
As you can see I’ve highlighted two items, the ‘Record ID’ field and the ‘Module’ field. You will need those two fields to create a translation that always works.
2. Writing your translations
Now that you have the technical details you only need to create translations for it. Go to settings > Application Terms > Translated Terms and you will see all the Odoo translations show op. From here on we will need to filter out the data and see if there aren’t translations yet. In the topright corner you should do an advanced search on the Record ID, which is in my case 606.
Click on ‘Apply’ and you will now only see data that is translated for this report. In my example:
Tip: Are you not seeing any translations? This means there are none for the report you wish to translate! Simply click on the form view and you can then create a new one from scratch. Type over the values from the first screenshot down here and change the fields ‘module’, ‘Record ID’, ‘Source Term’ and ‘Translation’ to your values.
As you can see this is only a part of the translations that I should need for this report so we will need to add more. Open up the form view and you will see all the technical details for one of the translated items on the report. Do you notice something interesting yet?
As you can see the Record ID and the module name are identical to the ones we found in part 1 of this tutorial. The combination of this module name and the exact ID of the QWeb report will always match up to the correct report, which means translated fields!
Now why would you create a new translation from scratch when you can re-use most of it? Click on the more button and then choose ‘Duplicate’.
Now an almost pre-filled record opens up. The only thing you have to do here is to change the Source Term and Translation to the text you want to translate. (Make sure the correct language is filled in where you want to write the translation for too). In my example on the quotation report the text ‘Description’ is not translated in Dutch as you can see:
So I will change the source term from ‘Date Ordered:’ to ‘Description and the Translation ‘Besteldatum’ to ‘Omschrijving’. Since you’ve duplicated this record and changed the values it will now be added as a new translation when you click on save. My example:
Click on save and you’ve made the new translation. Now repeat this process for all the fields you want to translate.
3. Synchronizing translations
The final step to make these translations work is to synchronize them. Go to settings > Application Terms > Synchronize Terms’ and click on it. A new dialog will now show up. Choose the language you made translations for and then click on ‘Update’.
Go back to the report you wish to print and print it out. You will now see all the fields are translated!
Tip: In case you want to translate Odoo in your language and want to share this with the community you should have a look at Launchpad translations. This is where translations are made by the community and they will become available for everybody!
hello,
What is meant by translating a report, i am new to odoo and confused what it is, why and when we should use translation.
Hi Shivam,
You should use translations when you want the report to be available in multiple languages. For example when you set the customer on a form and his language is not English (for example French) you should add translations in order to make it available in French too.
Hello Yenthe,
I was wondering what happens during an update ?
If the custom translations are lost wouldn’t it be better to put them in a module ? And if so how to build the translation file, in which directory of the module do we have to put it ? And finally how to tell our module to use the translation file ?
Regards
Vart