Odoo Help

Welcome!

This community 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.

1

How to pass variables in QWEB?

By
Abdullah Sofan
on 12/16/14, 1:02 PM 1,302 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

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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