Odoo Help



Yassine TEIMI
on 11/27/14, 10:03 AM 1,846 views

I have two form views and two tree views for an object, to decide which tree view will open, I used the PRIORITY concept, I did it by action : It means that for an action I specified wich tree view will open when the action is invoked, and this by adding : 

<field name="view_id" ref="view_order_tree"/>, view_order_tree is the id of the tree view I want to diplay for this action.

The problem is, how to do the same thing for the form view, I want to do it by action too, do you have any idea ? 

Yassine TEIMI
On 11/27/14, 11:27 AM

So I'll answer myself, hoping that might help other people.

Having several views of the same type is very recurrent in openerp, so the most complete solution is not the priority, and it's not the "by action" method, it's the DISPLAY MODE solution.

So for example, for an action action_orders, I'll assign for each DISPLAY MODE ( the horizantal list of possible views to display that we have below the search filter ), the view to show, because I have of course many possibilities for each type of view. and that is possible by this code : 

        <record model="ir.actions.act_window.view" id="action_sale_order_tree">

            <field name="sequence" eval="1"/>

            <field name="view_mode">tree</field>

            <field name="view_id" ref="view_order_tree"/>

            <field name="act_window_id" ref="action_orders"/>



        <record model="ir.actions.act_window.view" id="action_sale_order_form">

            <field name="sequence" eval="3"/>

            <field name="view_mode">form</field>

            <field name="view_id" ref="view_order_form"/>

            <field name="act_window_id" ref="action_orders"/>


So I assigned via the view_id field, the id of the view to display when clicking on the display mode, according to what type of view I want to display. all of that is hapenning when action_orders is invoked via menu click.

So I hope that helps someone.

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/27/14, 10:03 AM
Seen: 1846 times
Last updated: 3/16/15, 8:10 AM