How it works...

In step 1, we added a kanban view for the library.book.rent model. Note that we have used stage_id as the default group for kanban, so, when the user opens kanban, the kanban cards will be grouped by stage. To find out more about kanban, please refer to Chapter 10, Backend Views.

In step 2, we added the kanban keyword in the existing action.

In step 3, we added the group_expand attribute in the stage_id field. We also added a new _group_expand_stages() method. group_expand changes the behavior of the field grouping. By default, field grouping shows the stages that are being used. For example, if there is no rent record that has the lost stage, the grouping will not return that stage, so kanban will not display the lost column. But, in our case, we want to display all of the stages, regardless of whether or not they are being used.

The _group_expand_stages() function is used to return all the records for the stages. Because of this, the kanban view will display all the stages and you will be able to use workflows by dragging and dropping them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset