Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
11941 มุมมอง

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 .

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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)"/>

อวตาร
ละทิ้ง