The Kanban board is a simple method to manage workflows. It is organized in columns, each corresponding to stages, and the work items progress from left to right until they are finished.
There are a few features used across several Kanban boards, providing a common pattern that can also be used in our own custom modules. Let's visit those features.
To follow this recipe, you will need to have the Project Management app already installed.
To get started with a Project Tasks Kanban board:
Now
in the small dialog box, and click on Add. Repeat to also add the Later and Done stages.Kanban is one of the available view types, and it is able to organize items grouped in columns. If we use stages to group the work items, we get a Kanban board. The stage list can be configured to fit the user's specific needs.
Stages should have a folded attribute, meaning that the corresponding column in the Kanban view should be shown folded. Work in progress items are expected to be in an unfolded stage, and terminated items, usually Done and Cancelled, should be in Folded stages.
Each work item has a reference for the stage it is in. It may also have a Kanban State, represented by a traffic signal-like light, and a Priority, represented by a star. The Kanban cards can also have a color attribute, used for their background color.
While the stage represents the current status in the process for the work item, Kanban State provides information about its readiness to advance to the next stage. It is a Selection field, usually named kanban_state
, in the form, and Kanban views is used with the kanban_state_selection
widget and expects three possible options:
normal
database value)blocked
database value), meaning that there is some reason to retain the work item in the current stagedone
database value), meaning that the work item is ready to be pulled for the next stageThe Priority is also a Selection field, and is displayed with the special priority
widget in the form and Kanban views. The selection options are expected to be either a string with a number, starting at 0
, for normal value (not starred), and other values for starred options.
Stages are added to models through a Many2one
field referencing a stage model defining the possible stages. On form views, they can be represented with the help of the statusbar
pipeline widget. For more details on views, widgets, and designing Kanban views, you can refer to Chapter 8, Backend Views.
The complementary Kanban state is supported by a Selection field and its typical definition is:
kanban_state = fields.Selection( [('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State', default='normal')
On form views, it should use the specific kanban_state_selection
widget:
<field name="kanban_state" widget="kanban_state_selection" />
Regarding the Priority field, it is also a Selection field, and the number of options usually ranges between 2 and 4 selection items:
priority = fields.selection( [('0', 'Normal'), ('1', 'Low'), ('2', 'High'), ('3', 'Very High')], 'Priority', default='0')
In form views, it can make use of the specific priority
widget:
<field name="priority" widget="priority"/>