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

it should be simple I think.

all I want is just to show a context into a field.

ex:

<span>the active_id is: {context.get('active_id', false)}</span>

or 

<button string="the active id is: {context.get('active_id',false)}" />

I have spent days to look for this, yet no answer has been found. Any help would be very much appreciated. Thanks

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

Hi,

Suppose if you want to see what is there in the context inside a field in the view, what you can easily do is that, just a create a character field which is a computed field and return the value of the context into it so that you can see it in the view.


def _get_context(self):
self.context = dict(self.env.context)

context = fields.Char(string='Context', compute='_get_context')


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 25
1311
4
thg 1 24
23131
Attrs attribute Đã xử lý
2
thg 1 24
2431
0
thg 8 23
2291
0
thg 2 23
3093