Different types of views are present in Odoo, which helps users better understand the data. In this blog, we are going to discuss the Advanced Kanban view in Odoo 16.
The data are graphically represented as cards in Kanban view, and the records can be grouped for better visualisation.
Let’s have a look at a Kanban view for the model project.task in Odoo.
Let's see how we can use the different parameters in Kanban tag.
<kanban
default_group_by="stage_id"
class="o_kanban_small_column o_kanban_project_tasks"
on_create="quick_create"
quick_create_view="project.quick_create_task_form"
examples="project"
js_class="project_task_kanban" sample="1">
It is a kanban tag defined for project.task.
on_create
It allows to create record from kanban view itself.
on_create = “quick_create” option is used for creating records quickly from the kanban view itself.
The plus icon allows you to create and edit records.
‘Quick_create_form_view’ allows you to specify which form view should open while creating a record using this ‘+’ symbol.
We can also give a window action record id as its value.
<kanban
class="oe_background_grey o_kanban_dashboard o_project_kanban o_emphasize_colors"
on_create="project.open_create_project"
action="action_view_tasks" type="object"
sample="1"
default_order="sequence, name, id"
>
<record id="open_create_project" model="ir.actions.act_window">
<field name="name">Create a Project</field>
<field name="res_model">project.project</field>
<field name="view_mode">form</field>
<field name="view_id" ref="project_project_view_form_simplified_footer"/>
<field name="target">new</field>
<field name="context">{"default_allow_billable": 1}</field>
</record>
action
It can be used in other views as well. Along with type=”object” we can give a python function name in this parameter. In action we can specify a python function, which will be executed while clicking on the kanban record.
default_order
Using this parameter we can specify in which order the kanban records should be visible in view. Here tasks will be displayed accordingly related to their sequence, name and id fields.
By default it will be sorting the ascending order of the field given in this parameter, but if we want to order the record using descending order, we can specify it as
default_order = “name desc”
default_group_by
This parameter is used to group the kanban cards by a field. In the above example, the tasks are grouped by stages.stage_id is a field in project task.
examples
If set to a key in the KanbanExamplesRegistry, examples on column setups will be available in the grouped Kanban view.
group_create
group_create is used to create a new column in Kanban view. It’s default value is True, that is, if we didn’t specify this parameter in the kanban tag, it will be ‘true’ by default.
Adding a column can be prevented by giving group_create = “false”
group_delete
This parameter is used to remove a group.By default its value is true.
If we want to disable this feature, we can give group_delete=’false’ in the Kanban tag.
group_edit
It is used to edit a group.group_edit will be true by default. If we wish to disable this feature, we can give group_edit=”false”.
This option will be unavailable if we give group_edit=”false”.
archivable
Archivable option is also related to a group in Kanban view. It is used to archive and unarchive a group.
While specifying archivable=”false”, the Archive All and Unarchive All options will be removed.
records_draggable
This parameter allows you to drag and drop Kanban cards into different groups. Its default value is "true." If records_draggable=”false”, then drag and drop of Kanban records will be impossible.
Progress bar
It is used to have a progress bar at the top of a kanban group.
‘progressbar’ is defined inside the kanban view definition.
Below is an example of usage of progressbar in CRM leads
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
Two parameters can be used inside the progressbar, field, and colors
field: The progress bar will be displayed based on this field
colors: The various colors used in the progress bar are a success, warning, danger, and muted. We can assign these colors as the values to the required field.
Another optional parameter that can be used in the progress bar is sum_field.
sum_field: To get the sum of a particular field,
Below is an example of progress bar in CRM lead
In conclusion, Odoo 16 offers an advanced Kanban view that provides an interactive and visually appealing interface. The view has several features that make it more efficient and user-friendly, such as the ability to group, filter, and sort records and drag-and-drop functionality for quick and easy management of data.