Skip to Content
Menu
This question has been flagged
4 Replies
3965 Views

Hello

I try to change the visibility of a field depending if a element is selected in a many2many relation, but I cannot determine how to write the condition.

I can do this with a one2many,  but doesn't work with a many2many.


For exemple I have a multi select field with: X Y and Z values, and I want that an another field become visible if Y is selected.


Do you have an exemple to provide me ?


Thank you !

 

Avatar
Discard
Author

Hello all,

@Dhaval Desai will check your link but not sure that it contains my answers

@Haresh Kansara you don't understand fully my question, I know how to change the visibility of a fields depending another but i cant manage do do that with a manytomany fields as source

Regards,

Michel

Best Answer

Hi Michel,

you can use attrs for this. what you have to do is: assume that you have one field A and field A is boolean field and there is another field B. and you want to display field B if field A is selected (value=True)  then you can write attrs in field B in xml view.


<field name="A" />

<field name="B" attrs="{ 'invisible' : [('A', '=', False)] }"/>

so if field A is checked then field B is visible.

you can do something like this in your case. see this for reference https://www.serpentcs.com/serpentcs-attrs-in-openerp-odoo-254


Hope it will helpful for you.

Thanks and regards

Haresh Kansara

Avatar
Discard

Is there any way to do this on Python level?

Best Answer

HI,

you can follow below link:

    https://www.serpentcs.com/serpentcs-attrs-in-openerp-odoo-254

Make sure it will helpful.

Thank you.

Avatar
Discard
Best Answer

#odoo #openerp #ERP #customization

#tips #training #development #guide #python

Odoo Customization Tips

Avatar
Discard

sorry i just add the wrong link thats not working, now check its working fine