Odoo_Samples icon indicating copy to clipboard operation
Odoo_Samples copied to clipboard

Web auto refresh module on V9

Open effelle opened this issue 8 years ago • 7 comments

@Yenthe666 ,

I've read your reply on your blog just now. Sorry for the HUGE delay! How did you manage to add auto update to V9? Did you edit

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

F.

effelle avatar May 16 '16 22:05 effelle

Hi @effelle I poked around on Odoo and looked through the functions to find a correct option to refresh the View in Odoo 9. Haven't edited the one you linked.

Yenthe666 avatar May 19 '16 15:05 Yenthe666

Is there an option? Where?

effelle avatar May 19 '16 16:05 effelle

@effelle an example:

var refresh_page = function(view) {
    setInterval(function() {
        var active_view = view.action_manager.inner_widget.active_view;
        if (typeof(active_view) != 'undefined'){
            try {
                var controller = view.action_manager.inner_widget.active_view.controller;
                var action = view.action_manager.inner_widget.action;
                if (String(action.view_id).match(/Your view title/)) {
                    controller.reload();
                }
            } catch (e) {
                alert(e);
            }
        }
    }, 5000);
}

openerp.web.WebClient.include({
    start: function() {
        //alert("Start");
        this._super();
        refresh_page(this);
    },
})

This will reload the view once every 5 seconds.

Yenthe666 avatar May 20 '16 05:05 Yenthe666

Ok, this is a little confusing. You are using this on a single web module or did you add @ global level? BEcause this code should work on V8 too. Did you use this code on a stock module? Have you add an example on Odoo_sample? Thanks.

effelle avatar May 20 '16 11:05 effelle

@effelle I'm using this in a custom developed module to refresh one treeview. This has nothing to do with the stock module or anything.

Yenthe666 avatar May 20 '16 11:05 Yenthe666

Got it. I'll test on one of mine on V9 on the next testing. Thanks for now!

effelle avatar May 20 '16 11:05 effelle

Hi Yenthe,

I have same requirements in version 9 custom module tree view auto reload particular interval. Your code is working fine, but it reloads both form and tree view, in form view loss data, is any away auto reload prevent in form view and apply only in tree view. Thanks

prakashjain avatar Jan 04 '18 08:01 prakashjain