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

Loading data using YAML files


A third format for data import is YAML, which gives you less overhead than XML, but still more control than CSV. Traditionally, it was used for tests rather than for data import, which is why you have more possibilities to call code here.

How to do it...

Take the following steps to translate the first recipe in this chapter to YAML:

  1. Add in a file called data/demo.yml to your manifest, in the demo section:

        'demo': [
            'data/demo.yml',
        ],
  2. Add content to this file:

    -
        !record {id: author_af, model: res.partner}
            name: Alexandre Fayolle
    -
        !record {id: author_dr, model: res.partner}
            name: Daniel Reis
    -
        !record {id: author_hb, model: res.partner}
            name: Holger Brunn
    -
        !record {id: book_cookbook, model: library.book}
            name: Odoo cookbook
            short_name: cookbook
            date_release: 2016-03-01
            author_ids: [(6, 0, [ref('author_af'), ref('author_dr'), ref('author_hb')])]
            publisher_id: res_partner_packt...