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

How to make many2one field invisible

By
soumaya
on 5/31/16, 7:00 AM 302 views

Hi 
I am trying to make a field autre_id invisible 

I tryed many methods to do that and i did not work

this my method:

(.py)

        'autre_id':fields.many2one('mon_module.autre', 'الحالة الإجتماعية', required=False),

(.xml)

     <field name="autre_id" attrs="{'invisible': [(' autre_id ', '=', 'False')]}"/>

  <field name="autre_id" invisible="1"/>

Can you help me to solve that

and thinks 


0
soumaya
On 5/31/16, 2:13 PM

Thank you Pawan, but i tryed your solution and it does not work 

are you getting any error? can u provide your code..

Pawan
on 6/1/16, 4:14 AM

no i don't hava any error, but this field still visble in my view

soumaya
on 6/1/16, 4:16 AM

then check if you have defined that field again in your view.. after making it invisible.. or that view is inherited and that field is defined again.... or, is that view only loading?

Pawan
on 6/1/16, 6:41 AM
0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 5/31/16, 9:31 AM

Soumaya,

you can simply use :

 <field name="autre_id" invisible="1"/>

we use attrs in the case when we want to hide/readonly a filed on basis of some condition, for ex:

if you want to hide autre_id when your state is 'open',  you can use:

 <field name="autre_id" attrs="{'invisible': [('state', '=', 'open')]}"/>

Hope this help!

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: 5/31/16, 7:00 AM
Seen: 302 times
Last updated: 5/31/16, 2:13 PM