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 set a t-field with dinamic field name?

By
Yusnel Rojas Garcia
on 2/3/15, 12:27 PM 906 views

I'm have a page that accepts a get parameter to set the the field name I want to edit but can't make it to work with qweb syntax. An example of the qweb code is.
<div t-field="record.content"/>

I think I need something like :

<div t-field="record.#{field}"/>
or something like that.

I need to be able to set the content field dynamically that now is fixed in the example. Thanks in advance.!

EDIT: I think I must use t-field in order to be able to edit it in the website editor. That's why I can't use computed fields.

0
Yusnel Rojas Garcia
On 2/3/15, 4:28 PM

But that way the field wouln't be editable with the website editor which is my goal.

0
Jose Vasquez
On 2/3/15, 4:19 PM

You can create a function that will return the value you expect, and then add it to your Qweb.

To do this you create your function
function_dynamic def (self):

you add to your self.localcontext.update
'function': self.function_dynamic

And for your Qweb you add
<div t-esc = "function">

Greetings.

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: 2/3/15, 12:27 PM
Seen: 906 times
Last updated: 3/16/15, 8:10 AM