跳至內容
選單
此問題已被標幟
1 回覆
12196 瀏覽次數

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

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
1月 25
1271
4
1月 24
23061
2
1月 24
2405
0
8月 23
2278
0
2月 23
3073