Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
12425 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Jan 25
1483
4
Jan 24
23314
Attrs attribute Diselesaikan
2
Jan 24
2577
0
Agu 23
2363
0
Feb 23
3306