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.

0

Make fields invisible in some companies

By
Maarten
on 12/16/15, 7:34 AM 349 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

--Ray Carnes--
15697
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

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

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: 12/16/15, 7:34 AM
Seen: 349 times
Last updated: 12/18/15, 3:43 AM