Skip to content

Instantly share code, notes, and snippets.

@nbessi
Created May 24, 2013 13:34
Show Gist options
  • Save nbessi/5643542 to your computer and use it in GitHub Desktop.
Save nbessi/5643542 to your computer and use it in GitHub Desktop.
You can use ir.values in OpenERP to force an action on a hierarchical tree view when you click on a row
<!-- Opening task when double clicking on project -->
<record id="dblc_proj" model="ir.actions.act_window">
<field name="res_model">project.task</field>
<field name="name">Project's tasks</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt,kanban</field>
<field name="domain">[('project_id', 'child_of', [active_id])]</field>
<field name="context">{'project_id':active_id, 'active_test':False}</field>
</record>
<record id="ir_project_task_open" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>
<field eval="'project.project'" name="model"/>
<field name="name">View project's tasks</field>
<field eval="'ir.actions.act_window,'+str(dblc_proj)" name="value"/>
</record>
@kryskool
Copy link

instead of use str(dblc_proj), sur str(ref('dblc_proj')) to keep compatibility with old version

@yk2kus
Copy link

yk2kus commented Oct 16, 2015

Is it possible to have multiple hierarchical view for same object with different menus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment