Odoo Help


Invisible field with comparison to a many2many relation

on 10/6/14, 6:34 PM 1,538 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?


Roberto Cocchiararo
On 1/20/15, 4:05 PM

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


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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/6/14, 6:34 PM
Seen: 1538 times
Last updated: 7/22/16, 1:34 AM