Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
12235 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
січ. 25
1303
4
січ. 24
23117
Attrs attribute Вирішено
2
січ. 24
2424
0
серп. 23
2288
0
лют. 23
3090