콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
7317 화면

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
4월 25
5143
4
12월 19
8036
2
9월 19
6412
1
9월 16
9657
2
5월 22
15037