Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5795 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 24
2333
4
thg 5 23
10599
1
thg 1 19
9662
0
thg 10 17
3499
0
thg 11 16
2753