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

Get Odoo Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.