Odoo Help

0

How to make many2one field invisible

By
soumaya
on 5/31/16, 7:00 AM 424 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--
1412
| 4 4 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!

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.

Register

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)

Stats

Asked: 5/31/16, 7:00 AM
Seen: 424 times
Last updated: 5/31/16, 2:13 PM