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

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 ...

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