Odoo Help

Welcome!

This community 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.

0

selecting values in dropdown it should display specified tree view

By
supreeth
on 12/12/14, 7:04 AM 738 views

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>

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/12/14, 7:07 AM

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

supreeth
on 12/12/14, 7:10 AM

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.

Ivan
on 12/12/14, 7:52 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/12/14, 7:04 AM
Seen: 738 times
Last updated: 3/16/15, 8:10 AM