Enable Dark Mode!
how-to-create-kanban-view-in-odoo-17.jpg
By: Ayana KP

How to Create Kanban View in Odoo 17

Technical Odoo 17

Odoo 17 brings powerful tools to streamline your data management, and one such feature is the Kanban view. Kanban views provide a visual representation of your data, making it easier to manage and track information. In this guide, we'll walk you through the steps to create a Kanban view in Odoo 17.

Before we dive into the process, let's understand what Kanban views are. In Odoo, Kanban views present data in the form of cards, allowing for a more intuitive and user-friendly experience.

how-to-create-kanban-view-in-odoo-17-1-cybrosys

These views are highly customizable, enabling you to tailor them to your specific needs and preferences. In Odoo 17, creating a Kanban view is a straightforward process, and we'll guide you through it step by step.

1. Define Your Model

In Odoo, everything starts with a model – a representation of your business entity. For this guide, let's assume we're creating a Kanban view for a model called ‘test.model’. This model will have fields like name, description, and state.

from odoo import models, fields
class TestModel(models.Model):
    _name = 'test.model'
    _description = 'Test Model'
    name = fields.Char(string='Name', required=True)
    description = fields.Text(string='Description')
    state = fields.Selection([
        ('draft', 'Draft'),
        ('in_progress', 'In Progress'),
        ('done', 'Done'),
    ], string='State', default='draft')

2. Create the Kanban View

Now, let's move on to creating the Kanban view. In your module's views directory, create an XML file (e.g., test_model_views.xml):

<?xml version="1.0" encoding="utf-8"?>
<odoo>
   <record id="test_model_view_kanban" model="ir.ui.view">
        <field name="name">test.model.view.kanban</field>
        <field name="model">test.model</field>
        <field name="arch" type="xml">
            <kanban class="o_kanban_mobile" sample="1">
                <field name="name"/>
                <field name="description"/>
                <field name="state"/>
                <templates>
                    <t t-name="kanban-box">
                        <div t-attf-class="oe_kanban_global_click">
                            <div class="row">
                                <div class="col-12">
                                    <strong>
                                        <field name="name"/>
                                    </strong>
                                </div>
                            </div>
                            <t t-if="record.description.value">
                                <hr class="mt8 mb8"/>
                                <field name="description"/>
                            </t>
                            <div>
                                <field name="state"/>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
    <!--Add an action to open the Kanban view-->
    <record id="test_model_action" model="ir.actions.act_window">
        <field name="name">Test Model</field>
        <field name="res_model">test.model</field>
        <field name="view_mode">kanban,form</field>
        <field name="view_id"
               ref="test_model_view_kanban"/>
    </record>
</odoo>

Now that we've covered the basics of creating a simple Kanban view in the Odoo platform, let's delve into additional tools associated with it in the following sections.

Templates: The templates encompass a list of qweb templates, with the Kanban views requiring the definition of one root template.

Record: The record attributes represent the requested fields. Each field comes with two attributes, namely value and raw_value. While the value is formatted based on the user's parameters, the raw_value reflects the value retrieved directly from the read() function.

Field: The field is intended to be showcased within the Kanban view.

Odoo 17's Kanban views are not just about showing pictures, they help make your business work better. Take advantage of this chance, discover all the great things your information can do, and guide your business toward a future where everything runs smoothly.

To read more about configuring the advanced kanban view in Odoo 16, refer to our blog How to Configure the Advanced Kanban View in Odoo 16


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

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

location

Kochi

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

location

Bangalore

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

Send Us A Message