Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
12418 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
led 25
1478
4
led 24
23306
2
led 24
2575
0
srp 23
2362
0
úno 23
3298