Odoo Help


[odoo 8] How to use Invisible on file py

on 10/8/15, 4:05 AM 1,021 views

I have field

fields.Char('URL Common', invisible=True)

but it not working.

How i can fix it?

Make the field invisible through your XML. Either by not calling the field or by saying invisible="1".

on 10/8/15, 4:54 AM

Akhil P Sivan

--Akhil P Sivan--

| 5 4 7
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 10/8/15, 5:23 AM


Please tell me why do you need it from .py file? You can easily hide the field from XML view file in 3 ways:

1. Using attribute invisible="1", if you just need to hide.


<field name="your_field" invisible="1" />;

2. Using attrs, if you need to hide based on a condition.


<field name="total_amount" attrs="{'invisible':[('currency_id','!=',company_id.currency_id)]}"/>;

3. Using security groups, if you want  to display field only to the  members a particular group.


<field name="company_id" groups="your_group"/>;

Because i want to use python set value on invisible. Exp def _return_invisible(self): wh_hn = self.env.ref('fbv_core.warehouse_hn').pick_type_id.id wh_hcm = self.env.ref('fbv_core.warehouse_hcm').picking_type_id.id return ['|',('picking_type_id', '=', wh_hn), ('picking_type_id', '=', wh_hcm)] and on xml, i don't use get ref id

on 10/8/15, 5:31 AM

Then you don't need to call that field in view file, it will be hidden, no need to separately set an attribute in field definition. Or if you want to do something based on the value of inivisible and need to be hidden, then you can call the field with invisible="1" in view file.

Akhil P Sivan
on 10/8/15, 5:52 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: 10/8/15, 4:05 AM
Seen: 1021 times
Last updated: 10/8/15, 5:45 AM