Odoo Help

Welcome!

This community 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.

0

VIEWS PRIORITY Openerp7 [SOLVED]

By
Yassine TEIMI
on 11/27/14, 10:03 AM 1,223 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 ? 

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

 

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

        </record>

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/27/14, 10:03 AM
Seen: 1223 times
Last updated: 3/16/15, 8:10 AM