コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
6245 ビュー

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



アバター
破棄
関連投稿 返信 ビュー 活動
1
5月 21
2968
1
2月 21
18822
3
8月 24
6467
1
9月 22
2077
2
12月 17
17167