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

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.

主站蜘蛛池模板: 阜宁县| 曲麻莱县| 陇川县| 宝山区| 曲水县| 曲阜市| 黑龙江省| 大关县| 闵行区| 吉木萨尔县| 凤冈县| 农安县| 甘孜县| 三河市| 房产| 云南省| 凤山市| 浦江县| 无棣县| 天等县| 甘肃省| 汉川市| 神木县| 偃师市| 增城市| 新干县| 乐山市| 德昌县| 千阳县| 南溪县| 筠连县| 肥西县| 永宁县| 西安市| 大悟县| 牙克石市| 图木舒克市| 白水县| 离岛区| 遵义市| 锡林浩特市|