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

Embedded views


When you show a one2many or a many2many field on a form, you don't have much control over how it is rendered up to now if you haven't used one of the specialized widgets. Also, in the case of many2one fields, it is desirable sometimes to be able to influence the way the linked record is opened. In this recipe, we'll look into how to define private views for those fields.

How to do it...

  1. Define your field as usual, but don't close the tag:

    <field name="child_ids">
  2. Simply write the view definition(s) into the tag:

        <tree>
            <field name="name" />
            <field name="email" />
            <field name="phone" />
        </tree>
        <form>
            <group>
                <field name="name" />
                <field name="function" />
            </group>
        </form>
  3. Close the tag:

    </field>

How it works...

When Odoo loads a form, it first checks for reference fields if there are views embedded as outlined previously. Those...