Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
6056 Переглядів

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.

Аватар
Відмінити
Найкраща відповідь

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

Аватар
Відмінити
Найкраща відповідь

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



Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
трав. 21
2834
1
лют. 21
18621
3
серп. 24
6310
1
вер. 22
1930
2
груд. 17
16955