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

List views

After having spent quite some time on the form view, we'll now have a quick look at how to define list views. Internally, they are called tree views in some places and list views in others, but, given there is another construction within the Odoo view framework called tree, we'll stick to the wording list here.

How to do it...

  1. Define your list view:
    <record id="tree_all_customers" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <tree colors="blue: customer and supplier;
                          green:customer;
                          red: supplier">
                <field name="name" />
                <field name="customer" invisible="1" />
                <field name="supplier" invisible="1" />
            </tree>
        </field>
    </record>
  2. Tell the action from the first recipe to use it:
    <record id="action_all_customers_tree" ...

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