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

Two different tree_views for a same model ??

By
laribi
on 9/24/13, 1:20 PM 2,988 views

Hello,

Any body know how to create a second tree for the same model with different fields in the view ?

Thanks.

Why not create a single view and simply give viewing access to different groups. So some groups will see some columns while another group will see a different set of columns in the same tree. Thus you will kind of accomplish what you want.

kaynis
on 9/24/13, 2:20 PM

Hello thank you kaynis , but i dont want to use groups of user because i already work with multi society and multi users .. thx :)

laribi
on 9/25/13, 10:22 AM
0

Maniganda

--Maniganda--
1038
| 5 7 7
Bangalore, India
--Maniganda--
Maniganda
On 9/25/13, 10:31 AM

Create a Split action for your object like this create a tree view and action for that tree view and write split view for tree as mentioned below

<record id="tree_id" model="ir.actions.act_window.view"> <field eval="3" name="sequence"/> <field name="view_mode">tree</field> <field name="view_id" ref="tree_view_id"/> <field name="act_window_id" ref="action_id"/> </record>

and if you want another tree view create new tree view and action for that tree view and create split action for newly created action like this

<record id="tree_id1" model="ir.actions.act_window.view"> <field eval="3" name="sequence"/> <field name="view_mode">tree</field> <field name="view_id" ref="tree_view_id1"/> <field name="act_window_id" ref="action_id1"/> </record>

Thanks Maniganda , it works for normal model . But in the case of inherited model it dosent . Any idea ?

laribi
on 9/26/13, 7:07 AM

It worked thank you Maniganda

laribi
on 9/26/13, 9:32 AM
0
<record id="planned_task_line_tree" model="ir.ui.view">
        <field name="name">planned.task.line.tree</field>
        <field name="model">planned.task.line</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Planned Task Line">
                <field name="name"/>
                <field name="product_id" on_change="onchange(product_id)"/>
                <field name="uom_id"/>
                <field name="planned_qty"/>
                <field name="project_weight" />
                <field name="actual_weight" />
                <field name="completion" on_change="onchange_validation(completion)" invisible="1"/>
                <field name="prev_task_completion" invisible="1" />
                <field name="diff_task_completion" invisible="1" />
            </tree>
        </field>
    </record>




    <record model="ir.actions.act_window" id="act_open_planned_task_line">
       <field name="name">Planned Task Line</field>
       <field name="res_model">planned.task.line</field>
       <field name="view_type">form</field> 
       <field name="view_id" ref="planned_task_line_tree"/>
       <field name="context">{ 'tree_view_ref':'planned_task_line_tree'}</field>    
       <field name="view_mode">tree,form</field> 
    </record> 

    <menuitem action="act_open_planned_task_line" id="planned_task_line" name="Planned Task Line" parent="base.plannedtask" sequence="2"/>



  <record id="planned_task_line_tree2" model="ir.ui.view">
        <field name="name">planned.task.line.tree2</field>
        <field name="model">planned.task.line</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Planned Task Line">
                <field name="g_project_id"/>
                <field name="g_task_id"/>
                <field name="group_activity_id"/>
                 <field name="activities_id" />
                <field name="product_id" />

            </tree>
        </field>
    </record>

<record model="ir.actions.act_window" id="act_open_planned_task_line2">
       <field name="name">Planned Task Line Group</field>
       <field name="res_model">planned.task.line</field>
       <field name="view_type">form</field>  
       <field name="view_mode">tree,form</field>    
       <field name="view_id" ref="planned_task_line_tree2"/>
       <field name="context">{ 'tree_view_ref':'planned_task_line_tree2'}</field>
       </record> 

    <menuitem action="act_open_planned_task_line2" id="planned_task_line2" name="BOQ Acitivity Groups" parent="base.plannedtask" sequence="4"/>

here is my example of 2 tree views for the same clas.. hope it will help :D

Hi thanks for the answer but it dosnt work for me. I added the context field in the view with the view_id .. but it still not working :(

laribi
on 9/25/13, 10:21 AM

Hi Laribi. Do you got answer for this?

samba
on 2/16/15, 7:20 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

0 follower(s)

Stats

Asked: 9/24/13, 1:20 PM
Seen: 2988 times
Last updated: 2/5/16, 7:08 AM