Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web auto refresh module on V9 #5

Open
effelle opened this issue May 16, 2016 · 7 comments
Open

Web auto refresh module on V9 #5

effelle opened this issue May 16, 2016 · 7 comments

Comments

@effelle
Copy link

effelle commented May 16, 2016

@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.

@Yenthe666
Copy link
Owner

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.

@effelle
Copy link
Author

effelle commented May 19, 2016

Is there an option? Where?

@Yenthe666
Copy link
Owner

@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.

@effelle
Copy link
Author

effelle commented May 20, 2016

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.

@Yenthe666
Copy link
Owner

@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.

@effelle
Copy link
Author

effelle commented May 20, 2016

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

@prakashjain
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants