I need to hide multiple fields in my form , actually i want the whole group to be invisible when the checkbox is unchecked
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Buchhaltung
- Lager
- PoS
- Project
- MRP
Diese Frage wurde gekennzeichnet
Hi,
Try to do like following:
in py file:
def onchange_child_attending_school(self, cr, uid, ids, child_attending_school=False, context=None):
if child_attending_school:
return {'value': {'boolean': True}}
else:
return {'value': {'boolean': False}}
in xml file:
<field name="child_attending_school" on_change="onchange_child_attending_school(child_attending_school)/>
<group string="Education" colspan="4" col="6" attrs="{'invisible':[('boolean', '=', False)]}">
<field name="education_level"/>
<field name="class"/>
<field name="name_of_school"/>
<field name="residence"/>
<field name="school_address"/>
<field name="name_of_class_teacher"/>
<field name="school_telephone"/>
</group>
i did try that ,,, but it didn't work... :(
<field name="child_attending_school"/>
<group string="Education" colspan="4" col="6" attrs="{'invisible':[('child_attending_school', '=', False)]}">
<field name="education_level"/>
<field name="class"/>
<field name="name_of_school"/>
<field name="residence"/>
<field name="school_address"/>
<field name="name_of_class_teacher"/>
<field name="school_telephone"/>
</group>
Do you want to hide the group on onchange of child_attending_school?
no i want to hide the group when the child is not attending school ..
I did it , time ago , with the attrs ... but now i forgot how i did it last time , and its really annoying :D
i have edited my answer. Add one boolean field and try that one.
AttributeError: 'sna.orphan' object has no attribute 'onchange_child_attending_school'
Have you restarted the server?
it give me that error on the change event of 'onchange_child_attending_school', so i think restart services wont make a difference
You should restart the server for affecting changes of py file and need to update that module to affect changes of xml file.
Hi nehal, how can i do this for single field.. my scenario is,, when a admin confirm(check box is checked),, marks field has to disable/could not be edited.
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
RegistrierenVerknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
---|---|---|---|---|
|
3
Okt. 18
|
4632 | ||
|
1
Okt. 23
|
96 | ||
|
2
Feb. 25
|
1049 | ||
|
0
Sept. 23
|
4 | ||
|
0
Nov. 22
|
20 |