Odoo Help


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.


Fields are shown although it's defined as "invisible" in XML File.

on 6/5/16, 11:58 AM 252 views


I have created some new fields in the Partner module of odoo9. One of the new field is "ident"  that should ONLY show up when the partner type is a company: 

 <field name="ident" attrs="{'invisible':[('company_type', '=', 'person')]}" />

Works good so far: When I create new contact this modification works perfect. Also when I edit an existing contact it works

Here is the problem:

When I install my module on an fresh odoo instance with EXISTING contacts, I observe that when I want to edit this existing contact, the variable "ident" is shown although the contact is a person (not a company). 

Interesting: When I change the contact on the frontend to "company" and change it back to "person" (without saving the form) I see that the effect is correct. 

The problem is that when I have my module fresh installed and edit an existing contact, the variable does not behave as it should (being invisible on first edit of existing parter). After the first edit everything works out, but for a user that wants to install the module on his instance it could be confusing. 

Any ideas on how to load the right behavior on initial loading of the form?



Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
| 5 3 5
--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 6/6/16, 3:15 AM


Can you paste the company_type field [I think it is a selection]

Also you can try something like:

attrs="{'invisible':[('company_type', '!=', 'company')]}"
On 6/9/16, 3:44 AM

When review is select bad option category at a time invisible the field of description.

review = fields.Selection([('good', 'GOOD'),('bad', 'BAD')])


<field name="review"/>

<field name="description" attrs="{'invisible': [('review', '!=', 'good')]}"/>

On 6/6/16, 10:20 AM

Hi Ahmed, 

I tried both ways '!=' and '='. Both does not work :-(

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)


Asked: 6/5/16, 11:58 AM
Seen: 252 times
Last updated: 6/9/16, 3:44 AM