Skip to Content
Menu
This question has been flagged
1 Reply
508 Views



I need to auto refresh this kanban board , if new tickets are created by other users and assigned to me. It should auto reflect in my kanban board , without manual refresh the board to show new tickets or any updates on ticket.

Avatar
Discard
Best Answer

Hi,

you can use the JS code below and include it in your custom module. Once installed, it will automatically refresh the Kanban view whenever new tickets are created.


JS CODE:


/** @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: "help_desk_increment_refresh",


    setup() {

        super.setup?.(...arguments);

        if (this.props.resModel !== "helpdesk.ticket") return;


        const orm = useService("orm");

        const action = useService("action");

        let previousCount = null;

        let interval = null;


        onMounted(() => {

            interval = setInterval(async () => {

                const count = await orm.searchCount("helpdesk.ticket", []);

                // 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));

    },

});


for more details you can refer this blog: https://www.cybrosys.com/blog/overview-of-real-time-kanban-boards-in-odoo-18-with-auto-updates


Hope it helps.

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 25
618
0
Mar 25
1995
0
Oct 24
1958
1
Sep 24
2073
1
Aug 24
2090