This question has been flagged
3 Replies
31069 Views

I am trying to install new module which is dependent on sale along with demo data. Whenever I install the module it inserts demo data created by me as well as demo data preset in sale module. I would like to ignore demo data of dependent module e.g. sale and insert demo data which created by me in newly customized module. How to do it?

Avatar
Discard
Best Answer

Hello Nitin,


First create database by running odoo service as below:


./odoo-bin -d db_name –without-demo=WITHOUT_DEMO


Then install the module for which you want to install demo data through following command:

./odoo-bin -d db_name -i module_name


And it will work ....


Thanks and Regards,

Aaquib Kardame.

Avatar
Discard
Author

Great !! This is what I needed. Working. Thanks.

Best Answer

Hi Nitin,

By default there is no easy way to do it in Odoo. If you create a new database you have to choose if it is a demo database or not. If you choose for a demo database all demo data from all modules will be loaded and there is no technical option to specify this per module. You could technically inherit the default Odoo module(s) and remove the demo data again but that's probably not a good idea to do.


If you do not work with a demo database you could move your own 'demo' data into default data though. The default data is always loaded which means all your data will be shown, also if it is no demo database. For example under /data you have a file named 'your_table.xml':

<?xml version="1.0" ?>
<odoo>
    <data noupdate="1">
        <record id="sample_record_1" model="your.table">
            <field name="name">First record</field>
        </record>
</odoo>

You can then load it in the __manifest__.py under 'data' like this:

'data': [data/your_table.xml']

Regards,

Yenthe


Regards,
Yenthe

Avatar
Discard
Best Answer

Hi,
If you enable demo data, it will load the demo data of the all the module. In your case i feel it is better to load you data as data file, rather than demo file, so that the demo data of the other module will not get installed and you will get what you need.

 

See the sample data  file in the account module,



Link: https://github.com/odoo/odoo/blob/12.0/addons/account/data/data_account_type.xml

Thanks

Avatar
Discard