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

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
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

How to open a form view from click on list view?

Subscribe

Get notified when there's activity on this post

This question has been flagged
formv7clicktreelist
3 Replies
25099 Views
Avatar
René Schuster

This question is asked often for tree views, but not for list view.

First some disambiguation:

  • a tree view is a  view with view_type = form and view_mode = tree
  • a list view with view_type = tree

There a some very interessting differences between a list view and a tree view, e.g you can only use the parent-child-structure with list views, but that's not the topic.

For tree views, the solution is quite trivial. If the view_mode contains a form view, then a click on the tree view will automatically open the form view of the clicked record (though I don't know for sure if it's opened in the current or a new window). This is not the case for list views!

Anyway, for some more fancy actions triggered by clicking on a tree/list view, you will need to bind these actions with a ir.values record with key2 = tree_but_open.

When I try to open a form view of the clicked record in a list view it shows the form view, but for a new record. Not the clicked one.

Snippets:

           <record id="open_project_from_hierarchy" model="ir.actions.act_window">
                   <field name="name">Project</field>
                   <field name="res_model">project.project</field>
                   <field name="view_type">form</field>
                   <field name="view_mode">tree,form</field>
                   <field name="view_id" ref="view_project"></field>
                   <field name="search_view_id" ref="view_project_filter"></field>
                   <field name="domain">[('id','=',active_id)]</field>
                   <field name="context">{}</field>  
           </record>
                              
           <record id="ir_open_project_form" model="ir.values">
             <field name="key2" eval="'tree_but_open'"></field>
             <field name="model" eval="'project.project'"></field>
             <field name="name">View project</field>
             <field name="value" eval="'ir.actions.act_window,'+str(open_project_from_hierarchy)"></field>
           </record>            

Note the domain on the bound action.

Any advise? Is it even possible to open the form view of the clicked record in a list view?

 

Thanks.

2
Avatar
Discard
Sehrish

Open tree view in button click: https://learnopenerp.blogspot.com/2017/10/redirect-to-tree-view-from-button-click.html

Avatar
Andre de Kock
Best Answer

You can add the following to the tree view XML:

<button type="object" name="get_formview_action" string="Open" icon="fa-edit"/>
2
Avatar
Discard
Avatar
Shahriar Siddik
Best Answer

René, I also need to open the form view by clicking the hierarchical tree view element. Did you find anything?


1
Avatar
Discard
Avatar
Tony Green
Best Answer

openerp.your_module_name = function(instance) {

var QWeb = openerp.web.qweb;
_t = instance.web._t;

instance.web.TreeView.include({

activate: function(id) {
var self = this;
var result = self._super(id);

if (self.model == 'your.model'){

self.do_action({
type: 'ir.actions.act_window',
res_model: self.model,
view_type: 'form',
view_mode: 'form',
res_id: id,
views: [[false, 'form']],
});
}

return result;
},

});

Try to use this javascript

1
Avatar
Discard
Maxim Burinov

I could'n make "activate" called on odoo14. It seems they have changes JS API.

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
Related Posts Replies Views Activity
How to understand view name and model data anywhere in Odoo?
form view graph tree list
Avatar
Avatar
1
Mar 15
9374
Tree not showing "Add an item"
form tree
Avatar
Avatar
Avatar
Avatar
3
May 20
8414
How to make a form more wide?
form v7
Avatar
Avatar
Avatar
3
Mar 15
6776
How to delete the field "State" in partner form?
form v7
Avatar
Avatar
1
Mar 15
5063
One model, two forms and trees, how to set this up?
developement form tree
Avatar
Avatar
Avatar
3
Apr 24
2791
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 ภาษาไทย 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