Skip to Content
मेन्यू
This question has been flagged
1 Reply
3496 Views

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)]",)


Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
0
दिस॰ 15
5394
0
मार्च 15
4642
1
नव॰ 24
2253
1
अग॰ 23
3016
1
जून 18
3932