advanced-kanban-view-odoo-13.png
Blogger_636921856896094478.png
By: Sreejith Sasidharan

Advanced Kanban View in Odoo 13

Technical Odoo 13 Project

There are lots of views available on odoo. List, form, graph, pivot are some examples. Kanban is an interesting view. We have already a blog which describes how to make a default kanban view, you can refer the blog How to Create a Simple Kanban View in Odoo



In this blog we are discussing some elements of the Kanban view with pictorial representation of how it works, so let’s start.


    1. default_order

This feature is used for card sorting. Let’s see the working of this feature.

First of all, I am going to show the code for the kanban view which I created by reading the blog How to Create a Simple Kanban View in Odoo and the default view of the kanban.


# Code

<record id="student_kanban" model="ir.ui.view">
   <field name="name">student.kanban.view</field>
   <field name="model">student.student</field>
   <field name="arch" type="xml">
       <kanban>
           <field name="id"/>
           <field name="name"/>
           <field name="age"/>
           <field name="gender"/>
           <field name="student_dob"/>
           <field name="image_128"/>
           <templates>
               <t t-name="kanban-box">
                   <div t-attf-class="oe_kanban_global_click">
                       <div class="o_kanban_image">
                           <img alt="Avatar"
                                t-att-src="kanban_image('student.student', 'image_128',record.id.raw_value)"/>
                       </div>
                       <div class="oe_kanban_details">
                           <t class="o_kanban_record_title">
                               <strong t-esc="record.name.value"/>
                           </t>
                           <div t-if="record.age.value">
                               <t t-esc="record.age.value"/>
                           </div>
                           <div t-if="record.gender.value">
                               <t t-esc="record.gender.value"/>
                           </div>
                       </div>
                   </div>
               </t>
           </templates>
       </kanban>
   </field>
</record>

# Default Kanban View


advanced kanban view odoo 13 cybrosys


Hence this is the default view and view are applying each feature on this view. In this view the age of each person is not in order, now we are going to sort these persons in the order of increasing age type. We can use <kanban default_order="age asc">

Let’s look at the kanban view now,


advanced kanban view odoo 13 cybrosys


Now the people are sorted according to the increasing age. You can try other order methods also.


    2. group_create

The default value is true. This attribute decides whether the “Add a new column” bar is visible or not. We can explain this with the kanban view of the project module. 


advanced kanban view odoo 13 cybrosys


Here we can see the Add a Column option.

<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">


This is the kanban root element for the above view. We are going to add a group_create attribute. So the root element become


<kanban default_group_by="stage_id" group_create="false" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project">

Let’s check the view now.


advanced kanban view odoo 13 cybrosys


So there is no more Add a Column option.


    3. default_group_by

This attribute used to group the kanban view. Let’s take the example of the above, the tasks are grouped by stage. Ie, stage_id ( that can be seen in the root element of kanban )

Now I am going to change the default_group_by to user_id. default_group_by="user_id"

The view will become


advanced kanban view odoo 13 cybrosys


Grouped by the assigned person of the task.


    4. group_delete

The default value of this attribute is true. This attribute brings an option to delete the groups or not. Let’s look at a more easier way.


advanced kanban view odoo 13 cybrosys


Here we can see the option to delete the stage/group. But when we add group_delete="false"  we can’t delete the stage / group.


<kanban default_group_by="stage_id" group_delete="false" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project">


Added group_delete attribute.


advanced kanban view odoo 13 cybrosys


Now the delete option will not visible.


    5. group_edit

This is also the same as the above attribute. The default value is true. When we set it to false, the option for editing the group/stage will be invisible. 


<kanban default_group_by="stage_id" group_edit="false" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project">


advanced kanban view odoo 13 cybrosys


    6. archivable

The default value for this attribute is true. By setting the value to false we can remove the option for archived / restored for the group/stage. 


<kanban default_group_by="stage_id" archivable="false" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project">


advanced kanban view odoo 13 cybrosys


    7. quick_create

This feature is used to create records without switching to the form view. Here in the above case, we can say that we can create tasks without switching to form view. 


advanced kanban view odoo 13 cybrosys


This because of the attribute is true, now we are adding quick_create="false"

<kanban default_group_by="stage_id" quick_create="false" class="o_kanban_small_column o_kanban_project_tasks" on_create="quick_create" quick_create_view="project.quick_create_task_form" examples="project"> 


This time when we click the create button, the form view will appear.


    8. records_draggable

Consider the project task kanban view in the above example. Here we can drag the tasks to different stages. This is because the records_draggable attribute is set to true. If we add records_draggable="false"

The tasks will be no more draggable.


    9. Progress bar

This element will bring a progress bar element on top of kanban columns.

There are three possible attributes for this element.

Field: the progress bar is based on this field.

colors: we can assign colors to the values of the specified fields. Colors

available are,

success, warning, danger and muted.

sum_field: this is an optional attribute, while the others are required. If we give a field as a sum field. Sum of the fields of records will be shown in the progress bar.

Let’s take an example of project module task views:

<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger", "normal": "muted"}'/>


Here the progress bar is based on the kanban_state field. Let’s see what this field is

	kanban_state = fields.Selection([ ('normal', 'Grey'), ('done', 'Green'), ('blocked', 'Red')], string='Kanban State',
   copy=False, default='normal', required=True)


So the values of kanban_state fields are done, blocked and normal. We can see that the colors depend on these values. Likewise, we can give any fields and specify the corresponding values in the colors attribute.


advanced kanban view odoo 13 cybrosys


Here in the above picture, we can see the progress bar and the kanban_state is specified for each record.

To discuss the sum_field let’s take the example of the CRM module.


advanced kanban view odoo 13 cybrosys


Here we can see the value after the progress bar.

<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}' sum_field="planned_revenue" help="This bar allows to filter the opportunities based on scheduled activities."/>


This is how the progress bar is defined in the CRM module. Here the sum_field is defined as ‘planned_revenue’ we can see the planned revenue of each record in the kanban.


Here we discussed some kanban elements and how it is used.



cybrosys youtube

Comments

0


Leave a comment

 
Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

London

Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message
 
 
 
 
Close
cybrosys