Odoo Help


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

René Schuster
on 11/18/14, 9:37 AM 5,500 views

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.


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

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?



Shahriar Siddik
On 5/1/15, 10:42 PM

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

Tony Green
On 12/24/15, 10:17 AM

openerp.your_module_name = function(instance) {

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


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

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

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

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

1 follower(s)


Asked: 11/18/14, 9:37 AM
Seen: 5500 times
Last updated: 11/15/17, 11:20 PM