- Odoo 11 Development Cookbook(Second Edition)
- Holger Brunn Alexandre Fayolle
- 153字
- 2021-06-25 22:48:41
How to do it...
To create the basic skeleton for the addon module, perform the given steps:
- Create the directories for code files:
$ cd local-addons/my_module $ mkdir models $ touch models/__init__.py $ mkdir controllers $ touch controllers/__init__.py $ mkdir views $ mkdir security $ mkdir data $ mkdir demo $ mkdir i18n $ mkdir -p static/description
- Edit the module's top __init__.py file so that the code in subdirectories is loaded:
from . import models from . import controllers
This should get us started with a structure containing the most used directories, similar to this one:
. ├── __init__.py ├── __manifest__.py │ ├── controllers │ └── __init__.py ├── data
├── demo
├── i18n
├── models
│ └── __init__.py
├── security
├── static
│ └── description
└── views