İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
11933 Görünümler

How can I pass variable value in Qweb when calling a function?

I have this code :

<t t-set="fname" t-value="o.firstname"/>

<t t-set="lname" t-value="o.lastname"/>

<t t-set="city" t-value="o.city"/>

<t t-set="getadd" t-value="o.get_address('Graham','Sarah','Paris')"/>

<span t-esc="getadd"/>

 

How can I pass the variables in the first three lines to the function call in line 4? I can't put a t-esc within a t-set .

Avatar
Vazgeç
En İyi Yanıt

Hi Abdulaah,

Can you try like this.

<t t-set="fname" t-value="o.firstname"/>

<t t-set="lname" t-value="o.lastname"/>

<t t-set="city" t-value="o.city"/>

<t t-set="getadd" t-value="o.get_address(fname , lname , city)"/>

<span t-esc="getadd"/>

 

OR you can pass like this so you not need to create extra variables

 

<span t-esc="o.get_address(o.firstname,o.lastname,o.city)"/>

 

Thanks,
Harsh Dhaduk

 

Avatar
Vazgeç
En İyi Yanıt

Maybe I do not understand something, can not you do it this way (raplace all lines by one)?:

<span t-esc="o.get_address(o.firstname,o.lastname,o.city)"/>

Avatar
Vazgeç