Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
1340 Vizualizări

Hello odooers,

I search a lot but didn't found so I count on you.

I have developed some reports for my module and it occurs that I have insert variables to my text strings. Like here:

_("You have %s invoices wainting") % len(invoices)
In Python there is no problem. But how do I build this in qweb xml reports? Especially when I'm using html elements?


Thanks in advance for a short hint!


Regards,

Tastenmeister

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Hi Ermin,

many many thanks for your answer! My question is more about how to put this in xml/html output if I'm going to print a report (like pdf).

Should I use a t-attr to insert the python code?


Correct me, if I'm wrong, but normally xml is coded like this:

There are waiting for you until to be edited:



So when I'm using build in translation function, odoo is giving me either none of the string or just 3 parts, which is bad for translation.

So how can I output the whole block in xml, similar to:
("There are %s waiting for you until %s to be  edited:", $doc.invoices_amount, $doc.return_date)

I'm really glad, that you're helping me about this, since there is only very few documentation about translations when it comes to using in xml reports.

All the best,

Tastenmeister

Imagine profil
Abandonează
Cel mai bun răspuns

("%s Rechnungen warten auf Sie")

("Auf Sie warten %s Rechnungen")

Imagine profil
Abandonează