Odoo Help


How to hide certain product fields if the product doesn't belong to a certain categorie?

on 4/16/13, 2:48 PM 2,027 views

I have create some customized fields in normal.product.form but I want to show them only when the product belongs to a certain category name.

Could anyone give me a hand?


Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 4/17/13, 2:23 AM

You can use attrs attribute in xml.

For example:

<field name="field_name" attrs="{'invisible': ('prod_categ_name', 'in', ['categ1', 'categ2'])}"

attrs: Permits to define attributes of a field depends on other fields of the same window. (It can be use on page, group, button and notebook tag also)


attrs=“{‘attribute’: [(‘field_name’,’operator’,’value’),(‘field_name’,’operator’,’value’)],’attribute2’:[(‘field_name’,’operator’,’value’),]}

Where attribute will be readonly, invisible, required

Default value: {}.

Example: (in product.product)

<field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>

The problem I have is that I don't know the field name I have to use because in product.product I can't see any field declared for category name and If I go to product.normal.form view I can see "categ_id". But "categ_id" is not what I want because I want the category name and I could write something like this: attrs="{'invisible': [('category_name', '!=', 'my_category') ] }" I guess. Maybe is not possible as simple like that and I would need advanced coding skills.

on 4/17/13, 7:50 AM

Hi Sudhir, I want to hide all fields except product name for a particular group(ie, portal group). How can configure it?

on 5/9/13, 4:48 AM

Hi sudhir, how can hide some properties of a product from a particular group?

on 5/18/13, 8:55 AM

Thank you very much. It helped me. How can i show some text when a selectbox value is some value

Anantha Lakshmi
on 9/26/13, 5:18 AM

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.


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)


Asked: 4/16/13, 2:48 PM
Seen: 2027 times
Last updated: 3/16/15, 8:10 AM