While CSV files provide a simple and compact format to serialize data, XML files are more powerful and give more control over the loading process.
We have already used XML data files in the previous chapters. The user interface components, such as views and menu items, are in fact records stored in system models. The XML files in the modules are a means used to load those records into the server.
To showcase this, we will add a second data file to the todo_user
module, named todo_data.xml
, with the following content:
<?xml version="1.0"?> <openerp> <data> <!-- Data to load --> <record model="todo.task" id="todo_task_c"> <field name="name">Reinstall Odoo</field> <field name="user_id" ref="base.user_root" /> <field name="date_deadline">2015-01-30</field> </record> </data> </openerp>
This XML is equivalent to the CSV data file we have just seen in the previous section.
XML...