Odoo Help

1

How to pass variables in QWEB?

By
Abdullah Sofan
on 12/16/14, 1:02 PM 2,044 views

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 .

hello

Abdullah Sofan
on 12/16/14, 4:29 PM
2
Harsh Dhaduk
On 12/17/14, 12:03 AM

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

 

2
Zbik
On 12/16/14, 5:23 PM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 12/16/14, 1:02 PM
Seen: 2044 times
Last updated: 3/16/15, 8:10 AM