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

I would like to know if anyone knows how to clear the selection of a many2one field when a checkbox is decelerated, that is, it is empty.

Code xml:



Code Python:

analytic_level_1_show = fields.Boolean(string="Level 1")
analytic_level_1 = fields.Many2one('account.analytic.level', 'analytic_level_1', domain="[('is_level', '=', True),('level_1', '=', True)]",)


アバター
破棄
最善の回答

HI,

You can write an onchange function for the field analytic_level_1_show and from this onchange you can clear the value selected in the field analytic_level_1

@api.depends('analytic_level_1_show')
def onchange_analytic_level_1_show(self):
if not self.analytic_level_1_show:
self.analytic_level_1 = False



Onchange function in odoo: https://www.youtube.com/watch?v=Cj6ME0qNdno

Thanks

アバター
破棄
関連投稿 返信 ビュー 活動
0
12月 15
5322
0
3月 15
4600
1
11月 24
2126
1
8月 23
2927
1
6月 18
3884