Skip to Content
Menu
This question has been flagged
2 Replies
3574 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

Avatar
Discard
Author Best Answer

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. 

Avatar
Discard
Best Answer

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")]}" />
Avatar
Discard