Creating module with default data in database?

So i was trying to create a module which will be having more than 12000 hsn code by default

am not sure how i could put the default data in database when module is activated ?

so this module will be having code and description field

any headsup with this is much appreciated

In Tryton we don’t provide data in the modules, we prefer the approach of having a script that will populate the database.

See for example: modules/country: 3a7bb69289ce scripts/import_countries.py

Thanks for the reply … does this script runs automatically when we activates the modules ?

No but you can run it whenever you want if the data change without having to release a new version of the module.

You could make running the script part of your deployment routine if necessary.

Indeed it depends of the kind of data if it changes frequently, if it can customized etc. In some cases it may make sense to put data in XML like for the chart of accounts.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.