Help

0

Show value from ir.default in a form view

Avatar
Angelina

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
Discard
1 Answer
1
Avatar
Akshay Babu
Best Answer

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

Avatar
Discard