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
- 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.
- Define a transient model because we want only configure some default settings of different modules of Odoo.
- Make sure add that module as a dependency in your module to configure default settings.
- '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.
- 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