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

[odoo 8] How to use Invisible on file py

By
Tazan
on 10/8/15, 4:05 AM 555 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".

Yenthe
on 10/8/15, 4:54 AM
0

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
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

Hi,

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.

Eg:

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

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

 Eg:

<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.

Eg:

<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

Tazan
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

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: 10/8/15, 4:05 AM
Seen: 555 times
Last updated: 10/8/15, 5:45 AM