Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3373 Vizualizări

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


Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
dec. 15
5211
0
mar. 15
4550
1
nov. 24
2011
1
aug. 23
2866
1
iun. 18
3850