官术网_书友最值得收藏!

Chapter 2. Building Your First Odoo Application

Developing in Odoo most of the time means creating our own modules. In this chapter, we will create our first Odoo application, and you will learn the steps needed make it available to Odoo and install it.

Inspired by the notable todomvc.com project, we will build a simple to-do application. It should allow us to add new tasks, then mark them as completed, and finally clear the task list of all completed tasks.

You will learn how Odoo follows an MVC architecture, and we will go through the following layers during the to-do application implementation:

  • The model, defining the structure of the data
  • The view, describing the user interface
  • The controller, supporting the business logic of the application

The model layer is defined with Python objects that have their data is stored in the PostgreSQL database. The database mapping is automatically managed by Odoo, and the mechanism responsible for this is the object relational model, (ORM).

The view layer describes the user interface. Views are defined using XML, which is used by the web client framework to generate data-aware HTML views.

The web client views perform data persistent actions by interacting with the server ORM. These can be basic operations such as write or delete, but can also invoke methods defined in the ORM Python objects, performing more complex business logic. This is what we refer to as the controller layer.

Note

Note that the concept of controller mentioned here is different from the Odoo web development controllers. Those are program endpoints that web pages can call to perform actions.

With this approach, you will be able to gradually learn about the basic building blocks that make up an application and experience the iterative process of building an Odoo module from scratch.

主站蜘蛛池模板: 滨海县| 夹江县| 芜湖县| 二连浩特市| 丰镇市| 厦门市| 肇庆市| 马公市| 万州区| 平山县| 盈江县| 沈丘县| 延长县| 奇台县| 伊金霍洛旗| 雷波县| 瓦房店市| 兴义市| 南汇区| 乌鲁木齐市| 托克托县| 太康县| 大足县| 莱阳市| 都兰县| 三原县| 沧州市| 襄垣县| 句容市| 东城区| 繁峙县| 石城县| 长岛县| 巴林左旗| 米泉市| 简阳市| 醴陵市| 龙南县| 外汇| 万州区| 西藏|