Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3895 Visualizzazioni

Hello! I've set a default value for one of the fields in my model. It's stored in ir.default model (I found it in Settings -> Technical -> User-defined Defaults).
How can I show the value of this variable in my form view?

That's how I've set the value:

def set_default_value(self, value):
        IrValues = self.env['ir.default'].sudo()
        IrValues.set('my.model.model', 'my field', value.name)
        return IrValues

Now I wont to show the value of this field in view (view built by Transientmodel)

How can I call it?

Avatar
Abbandona
Risposta migliore

my_field = IrValues.get('my.model.model', 'my_field')

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
ago 19
3814
1
dic 21
6317
0
ott 21
2890
1
ott 21
3682
0
apr 21
2031