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

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.

主站蜘蛛池模板: 凭祥市| 塘沽区| 腾冲县| 蒙阴县| 孝感市| 华蓥市| 德化县| 天峻县| 盖州市| 通州市| 石景山区| 临夏县| 夏津县| 河北区| 汝州市| 抚松县| 江华| 佛山市| 祁门县| 万山特区| 泰顺县| 陆良县| 墨玉县| 正宁县| 长宁区| 永川市| 乌恰县| 那曲县| 青海省| 汽车| 北安市| 咸宁市| 周口市| 陇西县| 皋兰县| 康定县| 灯塔市| 深州市| 汽车| 乌海市| 新建县|