Odoo Help

0

Make fields invisible in some companies

By
Maarten
on 12/16/15, 7:34 AM 635 views

I have a multicompany installation with 2 companies. Volvo and BMW for example. I would like to make a field invisible when a user is not a member of the Volvo company.

<field name="locatie_beheer_project_nummer" attrs="{'invisible': [('user.company_id.name','!=','Volvo')]}"/>

I get the following error message. 

Error: Unknown field user.company_id.name in domain [["user.company_id.name","!=","Volvo"]]

What is the correct way to do this?

Best regards,

Maarten

0
Maarten
On 12/18/15, 3:43 AM

Ok good to know you can escape the form context. 

When I do this I get the error

NameError: name 'user' is not defined

Already decided to do it with groups, seems to be the better way. Just add all Volvo users to the group. 

0
Ray Carnes
On 12/16/15, 7:35 PM

What you have written is instructing Odoo to look for a field on your form/tree view called user.

Write this:

<field name="locatie_beheer_project_nummer" attrs="{'invisible': [([user.company_id.name],"!=","Volvo")]}" />

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.

Register

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)

Stats

Asked: 12/16/15, 7:34 AM
Seen: 635 times
Last updated: 12/18/15, 3:43 AM