Skip to Content
Menu
This question has been flagged
1 Reply
5706 Views

Hi everyone,

In hr.employee model I have a field called "x_dpt" which is a many2many relation between hr.employee and hr.department (because an employee can belong to several departments). I have also a field called "x_ab" which is also a many2many relation.

In the view hr.employee.form, I would like the field "x_ab" to be invisible if "x_dept" does not contain the development department (called "Development").

I tried this: <field name="x_ab" widget="many2many_tags" attrs="{'invisible':[('x_dept', '!=', 'Development')]}" /> but it don't seems to work.

Have you got an idea?

Thanks.

Avatar
Discard
Best Answer

This article helped me match a many2many to "empty":

http://ludwiktrammer.github.io/odoo/domain-for-empty-many2many-in-attrs.html

Afte that, he expains how to match it to a "pony with id 5", so that might help you (you would need the id of the "development" department).

PS: i know this is OLD, but googling for my problem gave me both the answer and your question :P

Avatar
Discard