O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Having an action open a specific view

Window actions automatically determine the view to be used, but sometimes we want an action to open a specific view.

We will create a basic form view for the partner model and make the window action specifically open it.

How to do it...

  1. Define the partner minimal form view:
    <record id="form_all_customers" model="ir.ui.view">
        <field name="name">All customers</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <form>
                <group>
                    <field name="name" />
                </group>
            </form>
        </field>
    </record>
  2. Tell the action from the previous recipe to use it:
    <record id="action_all_customers_form" model="ir.actions.act_window.view"> <field name="act_window_id" ref="action_all_customers" /> <field name="view_id" ref="form_all_customers" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required