Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how to auto refresh Kanban view

By
fisher
on 11/7/14, 11:06 AM 2,510 views

currently the auto refresh in action window definition does not work for kanban view (per study further, auto refresh even does not work for web, only works for GUI), is there any other way around? Kanban view to be auto refreshed such as new task and task status change is more important.

there is web notification module by anybox which is of great help, https://bitbucket.org/anybox/web_notification/src, now I know that I can use the existing bus mechanism to trigger and update the webpage based on changed captured, I can now broadcast the chagne message (to certain channel) from server side by the following lines

@api.one
    def create(vals, context=None):
        bus = self.env['bus.bus']
        message = {
            'subject': 'xx',
            'body': 'xx',
"""         'user_ids': [(4, x.id) for x in self],  """
            'mode': 'notify',
        }

but I have no idea on javascript side, how to access the current action manager or kanban view, then calling the re_load or something simliar to trigger the actual refresh!

I tried the following on javascript side:

(function() {
    openerp.web.WebClient.include({
        declare_bus_channel: function() {
            this._super();
            var self = this,
                channel = 'xx';
            this.bus_on(channel, function(message) {
                openerp.webclient.action_manager.start();
                self.do_notify(message.subject,
                                       message.body,
                                       message.sticky);
            });
            this.add_bus_channel(channel);
        },
    });
})();

but unfortunately failed. anyone can help to guide me by sample code or sample reference module?

Many thanks.

P.S Actually it will be very help to know in customized module how to manipulate the existing web component! in essence this is about the webclient object hierarchy.

0
fisher
On 11/12/14, 4:03 AM

there is new module released

 https://github.com/szufisher/web/tree/8.0/web_auto_refresh

0
angel lacret
On 6/15/15, 8:29 PM


DISCALIMER: Not the best FIX, but it's a FIX.

NOTE: In teory odoo 8 web client engine must execute the Action that the Wizards returns in the python code function. This works in all views, except in Kanban views. So this is the workaround:

In the server, create a message in the odoo bus, every time you want to notify something happends:

            bus = self.env['bus.bus']
            message = {
                'subject': '',
                'body': 'Appointment Set',
                'mode': 'notify',
            }
            bus.sendone('<CHANNEL-NAME>', message)

Then, in the frontend you must listen for a message on this channel:

First, register the channel (With out this, it wouldn't work)

    openerp.bmwe_crm = function(instance, local) {
        var bus = instance.bus.bus;
        bus.add_channel("<CHANNEL-NAME>");   
        });
    };

Second, reload the kanban when something happend in the channel:

    openerp.bmwe_crm = function(instance, local) {
        var bus = instance.bus.bus;
        bus.add_channel("<CHANNEL-NAME>");
        instance.bus.bus.on("notification", instance, function(notification){
            instance.client.action_manager.inner_widget.views["kanban"].controller.do_reload();
        });
    };

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 11/7/14, 11:06 AM
Seen: 2510 times
Last updated: 7/13/15, 11:28 PM