Loading data using XML files
Using the data model in Chapter 5, Application Models, 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 __manifest__.py
file:
- Add in a file called
data/demo.xml
to your manifest, in the demo section:
'demo': [ 'data/demo.xml', ],
- 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"> <field name="name">Odoo Cookbook</field> <field name=...