two setLang in the same line in rml -> pdf report

Asked by TArpi

Hi all,
Sys: OERP 6.0.2. on Ubuntu 10.10

I have the customer invoice report (account_print_invoice.rml) in two languages. I have the following line in the rml file:
[[l.uos_id.name]][['/']][[setLang(o.partner_id.lang)]][[l.uos_id.name]][[setLang(company.partner_id.lang)]]
and in the pdf I had pce/buc.
I upgraded the server to rev. 3462 and now I have the entire line only in one language, the first one.

To reproduce:
1. Fresh database
2. install a second language (a different as the main company)
3. translate the pce measure unit to that language
4. Modify the accpunt>report>account_print_invoice.rml change the line 257 to this :
<para style="terp_default_Right_9">[[ formatLang(l.quantity)]] [[ (l.uos_id and l.uos_id.name) or '' ]] [[ setLang(company.partner_id.lang) ]] [[ (l.uos_id and l.uos_id.name) or '' ]] [[ setLang(o.partner_id.lang) ]] </para>
5. Create a draft customer invoice with least one product, with pce measuring unit.
6. Print the invoice.

Thanks,
TArpi

Corrected: "line 275" to "line 257".

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
TArpi (teksearpi) said :
#1

Hello Vinay Rana,

First, the goal is to make a report where everything is in two languages. The first is the company language and the second is the partner language. For example (english and german):

Product1/produkt1 1 pce/stück 1 eur

And in the bug description I wanted to show something simple to have in two languages, the "piece".
So, to show that this functioned until now, and now does not, I wrote the steps how to modify the rml file to have the pce in two languages.

As you said the language for the entire document is the partner language. (set in line 143.)
In line 257 (and not 275 as I wrote in bug descr.) we have
             <para style="terp_default_Right_9">[[ formatLang(l.quantity)]] [[ (l.uos_id and l.uos_id.name) or '' ]]</para>

This should be modified to this to have "piece" in two language:
            <para style="terp_default_Right_9">[[ formatLang(l.quantity)]] [[ (l.uos_id and l.uos_id.name) or '' ]] [[ setLang(company.partner_id.lang) ]] [['/']][[ (l.uos_id and l.uos_id.name) or '' ]] [[ setLang(o.partner_id.lang) ]] </para>

Of course you have to make the steps from 1..3 in bug desc. before you make the changes in the rml file.

Expected: pce/stück
resulted: pce/pce

I hope this explication helps you, and excuse me if my english is not as expected.

Thanks,
TArpi

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#2

Hello Tarpi,

I am agree with you regarding setlang atribute. Here one thing I want to tell you, Lang is setting through context so when you changes the lang using setlang you have to call the browse function again to see the reflected changes otherwise it will not effect.

Now to solving your purpose you need to define new method which returns the passed language applied output, The setlang function will not solve your purpose because this is global method.

Hope this will helps you.

Thanks

Revision history for this message
TArpi (teksearpi) said :
#3

Hello Vinay Rana,

I used the above report until now, but I not encountered this error. The problem, is that I don't know the last server version, where this worked.

Thanks,
TArpi

Can you help with this problem?

Provide an answer of your own, or ask TArpi for more information if necessary.

To post a message you must log in.