How to do it...

We will use the scaffold command to create boilerplate code. Follow the given steps to create new a module using the scaffold command:

  1. Change the working directory to where we will want our module to be. This can be whatever directory you choose, but it needs to be within an add-on path to be useful. Following the directory choices that we used in the previous recipe, it should be as follows:
$ cd ~/odoo-dev/local-addons
  1. Choose a technical name for the new module, and use the scaffold command to create it. For our example, we will choose my_module:
$ ~/odoo-dev/odoo/odoo-bin scaffold my_module 
  1. Edit the __manifest__.py default module manifest provided and change the relevant values. You will surely want to at least change the module title in the name key.

This is what the generated add-on module should look like:

$ tree my_module
my_module/
├── __init__.py
├── __manifest__.py
├── controllers
│ ├── __init__.py
│ └── controllers.py
├── demo
│ └── demo.xml
├── models
│ ├── __init__.py
│ └── models.py
├── security
│ └── ir.model.access.csv
└── views
├── templates.xml
└── views.xml

5 directories, 10 files

You should now edit the various generated files and adapt them to the purpose of your new module.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset