Skip to Content
Menú
This question has been flagged
1 Respondre
504 Vistes



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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
1
d’ag. 25
617
0
de març 25
1994
0
d’oct. 24
1958
1
de set. 24
2071
1
d’ag. 24
2088