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 XML files

Using Chapter 4, Application Models data model, we'll add a book and an author as demonstration data, while we add a well known publisher as normal data in our module.

How to do it...

Create two XML files and link them in your __openerp__.py manifest file:

  1. Add in a file called data/demo.xml to your manifest, in the demo section:
        'demo': [
            'data/demo.xml',
        ],
  2. Add content to this file:
    <odoo> <record id="author_af" model="res.partner"> <field name="name">Alexandre Fayolle</field> </record> <record id="author_dr" model="res.partner"> <field name="name">Daniel Reis</field> </record> <record id="author_hb" model="res.partner"> <field name="name">Holger Brunn</field> </record> <record id="book_cookbook" model="library.book"> ...

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