Odoo Help

Welcome!

This community 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.

1

Invisible field with comparison to a many2many relation

By
DSI JEECE
on 10/6/14, 6:34 PM 949 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.

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

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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