Odoo Help


Two different tree_views for a same model ??

on 9/24/13, 1:20 PM 4,820 views


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


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.

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 :)

on 9/25/13, 10:22 AM
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 ?

on 9/26/13, 7:07 AM

It worked thank you Maniganda

on 9/26/13, 9:32 AM
<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" />

    <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> 

    <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" />


<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>

    <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 :(

on 9/25/13, 10:21 AM

Hi Laribi. Do you got answer for this?

on 2/16/15, 7:20 AM

About This Community

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


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