Scaffolding is a metaprogramming approach for building database-based applications. Many MVC frameworks use this idea. The programmer writes a specification describing how to use the database. The compiler generates code that adds, deletes, modifies, and searches the database. We call this model "scaffolding" and build powerful applications more efficiently on top of scaffolding.

Those of you who have used Django should know that Django uses manage.py startApp myApp to generate a directory structure for an app, which is a scaffolding.

Odoo also has its own scaffolding that we can run from the command line:

$ mkdir Odoo-Book-Demo && cd Odoo-Book-Demo $ .. /odoo-bin Scaffold name: python odoo-bin scaffold name destinatonCopy the code

Directory structure.

Bangumi $$CD tree. ├ ─ ─ just set py ├ ─ ─ __manifest__. Py ├ ─ ─ controllers │ ├ ─ ─ just set py │ └ ─ ─ controllers. Py ├ ─ ─ Demo │ └ ─ ─ demo. XML ├ ─ ─ models │ ├ ─ ─ just set py │ └ ─ ─ models. Py ├ ─ ─ security │ └ ─ ─ ir. Model. Access. CSV └ ─ ─ views ├ ─ ─ Templates. XML └ ─ ─ views. XMLCopy the code
  • The manifest __mainifest__.py file is the basic addon information file, such as the name, description, author and website link of the Addon, which is displayed in the Addons “install screen”.

  • Controllers are used to write web controllers.

  • Demo Directory for storing demo data initialized after addon installation.

  • Models are used to write ORM data models.

  • Security The directory where the permission definition files are stored.

  • Views stores the addon view definition file.

As you can see from the directory structure, Odoo is also a standard MVC pattern.

reference

Create an app using scaffolding