Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Two different tree_views for a same model ??

Subscribe

Get notified when there's activity on this post

This question has been flagged
10 Replies
34459 Views
Avatar
laribi

Hello,

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

Thanks.

1
Avatar
Discard
kaynis

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.

laribi
Author

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

Avatar
iWesabe Technologies
Best Answer


Hi,

ir.actions.act_window has view_ids attribute to specify views. You can  create multiple tree views and assign to different actions.

Note : Not sure workable in older versions !!


Thanks !


iWesabe

3
Avatar
Discard
Avatar
Lady Sharmane Udtuhan
Best Answer
<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

1
Avatar
Discard
laribi
Author

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

samba

Hi Laribi. Do you got answer for this?

Avatar
Maniganda
Best Answer

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>

1
Avatar
Discard
laribi
Author

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

laribi
Author

It worked thank you Maniganda

Avatar
Sehrish
Best Answer

Problem Statement

First of all you may know the problem that what's the problem that we are facing here. For example we have a model "model.A" and we have also a tree and form view associated with that model (model.A). And we have one menu named "menuA", and this menu is visible to the only one group of users such as "Staff". When any user related to staff group will click on "menuA" than our above created form and tree view will be displayed to the cited user. And for that group of users we need that all the fields should be editable mode. That's working fine. Now the problem is what we have do when we have different group of users, and for that users we need to show some fields in readonly mode.

Solution

To do that we have different solutions but here we are going to resolve this issue by splitting action window. First we will create a new form and tree view which we want to show different group of users, than we will create an action window using "ir.actions.act_window" model. If you want to read more about action window read this article Action Window in Odoo.

 <record model="ir.actions.act_window" id="parent_action_window">
    <field name="name">Parent Action Window</field>
    <field name="res_model">model.A</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>
 <record id="child_action_window_tree" model="ir.actions.act_window.view">
<field name="view_mode">tree</field>
<field name="view_id" ref="newly_created_tree_view_id_goes_here" />
<field name="act_window_id" ref="parent_action_window" />
</record>
 <record id="child_action_window_form" model="ir.actions.act_window.view">
<field name="view_mode">form</field>
<field name="view_id" ref="newly_created_form_view_id_goes_here" />
<field name="act_window_id" ref="parent_action_window" />
</record>

To get more details read : http://learnopenerp.blogspot.com/2017/12/display-multiple-form-and-tree-view-for.html

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now