Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
6034 Visninger

Is it possible to populate a selection field dynamically based on another field?
For example:

I have an integer field that the user populate with the value 3.

I want that the selection field automatically will be populated with the choices 1,2,3.

Thank you.

Avatar
Kassér
Bedste svar

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

Avatar
Kassér
Bedste svar

use like this

field_name = fields.Selection(selection=lambda self: self.dynamic_selection(), string="Scheme", tracking=True)
def dynamic_selection(self):
        objs = self.env['object.name'].sudo().search([])
        selection = [(rec.scheme, rec.scheme) for rec in objs]
        return selection



Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
maj 21
2826
1
feb. 21
18608
3
aug. 24
6277
1
sep. 22
1912
2
dec. 17
16941