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

Introducing the todo_stage module

In the previous chapter, we created an app for personal To-Do items. Now we want to take our app to the next level by improving its user interface, including a kanban board. The kanban board is a simple workflow tool that organizes items into columns, where these items flow from the left-hand column to the right, until they are completed. We will organize our tasks into columns, according to their stages, such as Waiting, Ready, Started, or Done

We will start by adding the data structures to enable this vision. We need to add stages, and it will be good to add support for tags as well, allowing the tasks to be categorized by subject. In this chapter, we will focus on the data models only. The user interface for these features will be discussed in Chapter 9, Backend Views - Design the User Interface, and Kanban views in Chapter 10, Kanban Views and Client-Side Qweb.

The first thing to figure out is how our data will be structured so that we can design the supporting models. We already have the central entity: the To-Do task. Each task will be at one stage at a time, and tasks can also have one or more tags on them. We will need to add these two additional models, and they will have these relationships:

  • Each task has a stage, and there can be many tasks in each stage
  • Each task can have many tags, and each tag can be attached to many tasks

This means that tasks have a many-to-one relationship with stages, and a many-to-many relationship with tags. On the other hand, the inverse relationships are that stages have a one-to-many relationship with tasks and tags have a many-to-many relationship with tasks.

We will start by creating the new todo_stage module and add the To-Do stage and To-Do tag models to it.

We've been using the ~/odoo-dev/custom-addons/ directory to host our modules. We should create a new todo_stage directory inside it for this new addon module. From the shell, we can use the following commands:

$ cd ~/odoo-dev/custom-addons
$ mkdir todo_stage
$ cd todo_stage

We begin by adding the __manifest__.py  manifest file, with this content:

{
  'name': 'Add Stages and Tags to To-Dos',
  'description': 'Organize To-Do Tasks using Stages and Tags',
  'author': 'Daniel Reis',
  'depends': ['todo_app'],
}

We should also add an __init__.py file. It is perfectly fine for it to be empty for now.

Now we can install the module in our Odoo work database and get started with the models.

主站蜘蛛池模板: 清苑县| 乌拉特前旗| 绿春县| 德保县| 眉山市| 铜川市| 高陵县| 义乌市| 乌什县| 宣威市| 黄大仙区| 嵩明县| 浦江县| 沧州市| 宁武县| 获嘉县| 台东市| 台山市| 扬州市| 朔州市| 安仁县| 遂昌县| 曲阳县| 绥宁县| 闵行区| 唐山市| 西充县| 万山特区| 湘西| 孟州市| 龙泉市| 博罗县| 治多县| 泸州市| 古蔺县| 利辛县| 元氏县| 宣汉县| 深泽县| 博爱县| 清徐县|