Set two languages in rml report

1.2k views Asked by At

Is it possible to specify language for every field? For example report would be multi-language, so same field would need to be translated in two languages in same report. Report is divided in two parts, first part is one language and the second part is another language. So fields in both parts are the same, but they need to be translated in different languages.

I know there is a function setLang(), but using it twice, for some reason one language overrides the other. Any suggestions?

P.S. I asked this question here: http://help.openerp.com/question/29996/set-two-languages-in-rml-report/, but no one answered, so figured maybe someone in stackoverflow will know about it..

2

There are 2 answers

0
CZoellner On

It's even easier to use multi-language in rml reports.

Pure text/strings will be treated by OpenERP localization anyway. (you have to translate it with these little .po translation files for every language)

You have to set the language to use in the report dynamically with e.g.:

[[ setLang(o.partner_id.lang) ]]

Here it will use the language of the partner (example is from an invoice report)

'o' has to be defined somewhere in the story before that (typically: [[ repeatIn(objects,'o') ]]) The whole report will now use this language.

To format numbers (decimal mark format is the best example) you have to use formatLang() function like:

formatLang(o.taxed_amount, digits=2)

to get

DE --> 23,25

US --> 23.25

or for using currencies

formatLang(o.amount_untaxed, digits=2, currency_obj=o.currency_id)

or for formatting dates/datetimes

formatLang(o.date_invoice, date=True)

OpenERP will try to use language options from the languages you can find on Settings->Translations->Languages (v7)

Hint: Without using setLang() OpenERP will use the language of the logged in user.

0
Bhavesh Odedra On

as per my knowledge this will help to print report in multi currencies, OpenERP has option

  • setting --> configuration --> invocing --> Features --> Allow multi currencies

    when we print report in OpenERP, generally rml take language as the seted or loaded or preferred, if we want to do in rml than we use setLang() function.

Hope this will help you