تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7354 أدوات العرض

Hi everyone !

    I have field : 
       <field onchange="changelasach(doorchecklouvre)" name="doorchecklouvre"></field> .
       <field invisible="1" name="doorlouvresizes"></field>

   function onchange :
     def changelasach(self, cr, uid, doorchecklouvre, context=None):
           _status = 1
           if doorchecklouvre:
              _status = 0
             return {'doorlouvresizes': [('invisible', '=', _status)]}

I want to the checkbox is checked, the field with name ="doorlouvresizes" is show ,back hide

can you help me ?

thanks hungnt

الصورة الرمزية
إهمال

Can you explain your question correctly so that we can understand and answer.

الكاتب

I have a checkbox and a textbox,When checkbox is checked ,the textbox is show and reverse it hide

أفضل إجابة

You can use attrs for this purpose. For example let the two fields be field1 and field2. If field1 is checked field2 will be visible, otherwise it will be hidden. In py file

'field1': fields.boolean('Field1'),
'field2': fields.char('Field2', size=64),

and in the view

<field name="field1"/>
<field name="field2" attrs="{'invisible':[('field1', '!=', True)]}" />

Check the screenshots

1) field1 is not checked

field1 is False

2) field1 is checked and field2 is shown

field1 is True

الصورة الرمزية
إهمال
الكاتب

Thanks

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أبريل 25
5156
4
ديسمبر 19
8062
2
سبتمبر 19
6445
1
سبتمبر 16
9680
2
مايو 22
15071