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

Hi all,

senario is: i have a drop down field contains two static values. if i click on one "static value' it should display one specificed tree view and vice verse for another value.

Note: both tree view's are different.

My code:

                                <group style="width:280px;">
                    <field name='pay_value'/> 
                </group>
                 <group>
                     <div>    
                        <div attrs="{'invisible': [('pay_value', '=' , False)]}">
                            <field name='program_line' nolabel='1' readonly="context.get('ctx', False)">
                                <tree string="Req Order Lines" editable="bottom">
                                    <field name = "s_no"/>
                                    <field name="program_id"/>
                                    <field name="program_code"/>
                                    <field name="value"/>
                                </tree>
                            </field>
                        </div>
                    </div>
                    <div>
                        <div attrs="{'invisible': [('pay_value', '=' , False)]}">
                            <field name='project_value_line' nolabel='1'>
                                <tree string="Req Order Lines" editable="bottom">
                                    <field name = "sr_no"/>
                                    <field name="s_range1"/>
                                    <field name="e_range1"/>
                                    <field name="value1"/>
                                </tree>
                            </field>
                        </div>
                    </div> 
                </group>

아바타
취소
베스트 답변

You can implement it using invisibility.  First, create the two tree views.  Then set the invisible attribute of each tree to be based on the drop down fields' value.

아바타
취소
작성자

yes i did that. but when i select one value two views are displaying at a time i have pasted by code above

What you have stated there is that you want to display both tree if pay_value is empty. I believe that is not what you want? The domain that sets invisibility needs to be changed to something like [('pay_value', '!=', 'value1')] for 'program_line' and [('pay_value', '!=', 'value2')] for 'project_value_line'. This way 'program_line' will be shown if 'pay_value' has the value of 'value1', and so forth.