1

How can I access the variable from a function? For example:

def get_data(self):
    var = "I am a variable"

Then I would like to get the data of var from that function and put it to my report. And this is what I did:

<span t-esc"o.get_data(var)"/>

But I am facing an error like TypeError: get_data() takes 1 positional argument but 2 were given.
Any idea on how to achieve this?

2 Answers 2

1

I just got the answer. I just put a return to var.

def get_data(self):
    var = "I am a variable"
    return var

then put this on a report: <span t-esc="o.get_data()/>

Sign up to request clarification or add additional context in comments.

Comments

0

you can also pass the params in xml,

<span t-esc="o.get_data(a)/>

and in python

def get_data(self, a):
    name = a
    return name

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.