Set Default Configurations
Set default configurations in Odoo through module
If you are a company or you provide OdooERP solutions then you might face a problem and the problem is that you need to set up some configurations for every time. In this blog, you will learn to build a module that setup all these configurations when you install this module.

Code

Explanation
  1. First, I import logging it is not necessary to import but for testing purpose I import it and I also recommend you to use this.
  2. Define a transient model because we want only configure some default settings of different modules of Odoo.
  3. Make sure add that module as a dependency in your module to configure default settings.
  4. 'res.config.settings' is a table where all configurations are stored so we can pass a dict of 'config_datas' to it then it will create a record using create method.
  5. At last, we call execute() method to save or execute all changes.
For reference purpose you can download this code from github too. https://github.com/OdooConcepts/odooconcepts

Good luck!

Share