Typically, a module should contain a business object layer, an object view layer, and a controller layer. As with most Web frameworks, at their most basic, they are MVC architectures. We’re just used to calling it differently. Teachers or students with obsessive-compulsive disorder, please match it with the traditional MVC and various layers, and leave a message below for others to understand. Thank you.

Business Object layer

The business object layer, in the module directory, usually corresponds to the Models folder. In this folder, you must have an __init__.py file and several business object files (also known as model files). Business objects are declared as Python classes, written in.py files (called resource files) that are configured by Odoo based on references in __init__.py files. Note: Transient model files are usually stored in the Wizard folder. To look down.

Object View layer

Object view layer, in the module directory, usually corresponding to the views folder. In this folder, there are.xml files (we call them view files) that are used to build the UI display of the business objects. Each time you add a new view file, you need to add the view file path to the value corresponding to the data key in the module manifest file manifest.py.

The controller layer

The controller layer, in the module directory, usually corresponds to the Controllers folder. Used to handle requests from web browsers. In this folder, you must have an __init__.py file and several routing files (we call controller files, interface files, routing files). Similarly, routing files are declared as Python classes, written in.py files (called resource files) that are configured by Odoo based on references in __init__.py files.

In addition to the files that correspond to the basic MVC framework, there are folders,

Static file management folder

In the module, name it static. Normally, there are two more valid folders under the module: the Description and SRC folders. The description folder is used to store the module icon (icon.png). Under the SRC folder, there are folders such as CSS, IMG, JS, XML, and SCSS to store different static files.

Resource internationalization folder

In the module, name it i18N. I18n (from the first and last characters of the English word I and N, with 18 being the middle character) is short for “internationalization.” That’s what we were talking about, translating files.

The data folder

It is used to store preset data files.

The demo folder

Mostly used to store demo data files.

Wizard folder

The Wizard folder usually houses the transient model files, including its business model and its view files. Under this folder, there is usually also an __init__.py file, several business object resource files (.py), and several view files (.xml). The init.py file is used to reference the business object resource file under the Wizard folder, and the view file is referenced in the data key of the module’s __st__.py folder.

Note: The data in the transient model will not be permanently stored in the database. Odoo system will clean the data once in a while. Transient models are generally used to implement functions that do not require storing data in a database, and the implementation will be demonstrated in a later section.

Security folder

Used to store module permission, rules, and group files. There are usually several *_security.xml files and an ir.model.access.csv file. *_security. XML is used to configure rules and group information, and ir.model.access. CSV is used to configure group permissions. If you see this and feel confused, don’t worry, the implementation here will be demonstrated in a later chapter.

Reprot folder

Used to store custom report files. QWEB is used to customize reports. Similar to wizard, this folder also has an __init__.py file, several business object resource files (.py), and several view files (.xml). The init.py file is used to reference the business object resource file under the Wizard folder, and the view file is referenced in the qWeb key of the module’s __st__.py folder. The implementation will be demonstrated in a later section.

Doc folder

Not commonly used, more than store module description file

Test and Tests folders

Unit testing in a development environment.

- Models folder, used to store business object model (database table) files and referenced by an init.py file. - Security folder, mostly used to control permissions. In Odoo12, this folder and the permissions under it are required. - Views file, used to store view files. View files are in XML format and form UI display of service objects. -__ init__.py, the node referenced between py files, opens the py file from bottom to top. -__ Manifest__. py, used to configure module information and manage view references.Copy the code