Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Search views


When opening your list view, you'll notice the search field to the upper right. If you type something there, you get suggestions about what to search for and there is also a set of predefined filters to choose from. This recipe will walk you through how to define those suggestions and options.

How to do it...

  1. Define your search view:

    <record id="search_all_customers" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <search>
                <field name="name" />
                <field name="category_id"
                       filter_domain="[('category_id', 'child_of', self)]" />
                <field name="bank_ids" widget="many2one" />
                <filter name="suppliers"
                        string="Suppliers"
                        domain="[('supplier', '=', True)]" />
            </search>
        </field>
    </record>
  2. Tell your action to use it:

    <record id="action_all_customers...