Enable Dark Mode!
overview-of-real-time-kanban-boards-in-odoo-18-with-auto-updates.jpg
By: Sonu S

Overview of Real-Time Kanban Boards in Odoo 18 with Auto Updates

Technical Odoo 18

Odoo is widely regarded as a highly flexible and intuitive ERP platform, providing a comprehensive range of business applications including CRM, sales, inventory, and accounting. With the launch of Odoo 18, the platform has taken a step further, bringing improvements in performance, a refreshed user interface, and more interactive features designed to boost efficiency across organizations. A notable enhancement in Odoo 18 is the support for real-time updates across different modules, allowing teams to make informed decisions quickly without delays.

Among the various views Odoo offers, the Kanban view stands out as an effective tool for managing projects, tracking tasks, and visualizing sales pipelines. Kanban boards let users easily monitor workflows, move items between stages, and identify bottlenecks at a glance. In Odoo 18, these boards have become even more dynamic: changes made by one user are instantly visible to others. This auto-refresh functionality keeps everyone on the same page, eliminating the need to manually reload pages and fostering smoother collaboration and faster response times.

Here’s an example of a custom patch that enables automatic refresh for the crm.lead Kanban board whenever the number of leads increases. This approach ensures that your sales or project teams always see the latest information on the board without having to manually reload the page.

By implementing this patch, the Kanban board monitors the total number of leads in the system at regular intervals. If a new lead is added, the board will automatically refresh, showing the new record immediately. This is particularly useful incollaborative environments where multiple users are creating or updating leads simultaneously. It eliminates delays, reduces the risk of missing critical updates, and improves overall workflow efficiency.

Additionally, this solution is lightweight and easy to maintain. It only affects the crm.leadKanban view, so other Kanban boards in Odoo remain unaffected. Theinterval-based approach strikes a balance between responsiveness and serverload, ensuring that the board refreshes frequently enough to be practically real-time, without overloading the server with unnecessary queries.

Now, let’s take a look at the actual code implementation:

JSCode

/** @odoo-module **/import { KanbanController } from "@web/views/kanban/kanban_controller";import { patch } from "@web/core/utils/patch";import { useService } from "@web/core/utils/hooks";import { onMounted, onWillUnmount } from "@odoo/owl";patch(KanbanController.prototype, {    name: "crm_lead_increment_refresh",    setup() {        super.setup?.(...arguments);        if (this.props.resModel !== "crm.lead") return;        const orm = useService("orm");        const action = useService("action");        let previousCount = null;        let interval = null;        onMounted(() => {            interval = setInterval(async () => {                const count = await orm.searchCount("crm.lead", []);                // Only refresh if previousCount is set and count increased                if (previousCount !== null && count > previousCount) {                    await action.doAction({ type: "ir.actions.client", tag: "reload" }, { replaceLastAction: true });                }                previousCount = count;            }, 5000); // check every 5 seconds        });        onWillUnmount(() => clearInterval(interval));    },});

This patch enhances Odoo’s KanbanController specifically for the crm.lead model, enabling the Kanban board to automatically detect and display new leads as they are added. It uses two essential Odoo services: orm, which counts the total number of leads in the system, and action, which reloads the Kanban view whenever an update is necessary. Once the Kanban view is loaded, the code establishes a 5-second interval that continuously monitors the lead count. If the current number of leads is higher than the previous count, the board refreshes automatically, ensuring that newly created leads appear instantly. The previous Count variable serves as a check point to avoid unnecessary reloads when no changes occur. Moreover, the interval is cleared using on Will Unmount when leaving the view, which prevents memory leaks and unnecessary database queries.

Include this JavaScript file in your custom module and add it to the assets section of the manifest. Once that is done, the auto-refresh functionality will work correctly. Let’s go through a live example below:

Below is an example demonstrating how the lead automatically appears in Marc Demo’s CRM Kanban view without manual refreshing:

The marc demo lead the kanban view as shown in the figure(before creating the new lead)

overview-of-real-time-kanban-boards-in-odoo-18-with-auto-updates-cybrosys

Then the administrator creates a lead for a customer and assigns ‘Marc Demo’ as the salesperson, then clicks ‘Save’ as shown in the figure below.

overview-of-real-time-kanban-boards-in-odoo-18-with-auto-updates-cybrosys

After that, without needing to manually refresh, Marc Demo’s session will automatically display the new lead in his CRM Kanban view, as shown below.

overview-of-real-time-kanban-boards-in-odoo-18-with-auto-updates-cybrosys

This method offers a simple and efficient way to make Kanban boards almost real-time, significantly improving visibility and collaboration within teams. For instance, in a Help Desk or Customer Support module, agents can immediately see new tickets as they are submitted without manually refreshing the page. Likewise, it can be applied to sales pipelines, project management tasks, or any module where real-time updates enhance workflow. Although the interval-based approach is straightforward, it is lightweight, easy to implement in Odoo Enterprise, and provides a practical solution for businesses aiming to increase team productivity and responsiveness.

To read more about How to Configure Advanced Kanban View in Odoo 18, refer to our blog How to Configure Advanced Kanban View in Odoo 18.


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



0
Comments



Leave a comment



whatsapp_icon
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