1

I want to modify the RFQ report and in that I wanted to call a python method from the Qweb report,

here is some sample code,

<span t-field ="o.my_custom_fuction()" />

and my python function is like

@api.model
def my_custom_function(self):
    return "some_value"

But it is giving me error like qwebException : "my_custom_function()" while evaluating.

Any clue what I am missing?

1 Answer 1

4

The t-field directive can only be used when performing field access (a.b) on a "smart" record (result of the browse method).

To call that function You will need to use t-esc (takes an expression, evaluates it and prints the content):

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

I used Odoo QWEB reference

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

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.