OpenERP installs xml sample data with new module

Sorry for my english

Today I am trying to develop a new module in OpenERP v7. My module works exactly the way I want, but when I exchange it with my teammates, after installing it, they must insert a lot of data manually in order to test all the functions of the module. Therefore, I suggest creating an xml file containing some demo data.

I follow the documentation at this link

https://doc.openerp.com/trunk/server/03_module_dev_01/

Here is the contents of my openerp.py

{ 'author' : "Oussama", 'version' : '0.1', 'name' : "School Management", 'description' : "My Module for school", 'category' : 'School', 'sequence' : 0, 'depends' : ['base'], 'demo' : ['school_demo.xml'], 'installable' : True, 'application' : True, 'auto_install' : False, } 

The structure of my school_demo.xml based on official documentation

 <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <record id="job_1" model="ao_sc_job"> <field name="name">Teacher</field> </record> <record id="job_2" model="ao_sc_job"> <field name="name">Director</field> </record> </data> </openerp> 

In this file I am trying to add only two entries to the ao_sc_job table, but when I restart the server and update my module, I did not find the entries in the ao_sc_job table.

I don’t know if I missed something. Any help would be greatly appreciated.

Thanks.

+4
source share
1 answer
  • Check the model name: you may have model names, such as "ao.sc.job", with your py file for the model name. You should use the model name, not the table name.
  • Make sure you update the module. you can use the -u module_name option when restarting the server. Or you need to update the module from the GUI after reinstalling the server.
  • Make sure your database is created with the option "Download demo data"
+3
source

Source: https://habr.com/ru/post/1483005/


All Articles