Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3613 Tampilan

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>

Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang
Penulis

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.