Help

3

How to refresh the original view after wizard actions?

Avatar
Hannes Smit

I built a wizard with multiple views on the same wizard class. After proceeding through all the steps, the users hits the last button.

The python code:

return {}

Then, the form view is not refreshed.

However, after the first step in the wizard, the original form view refreshes.

Avatar
Discard
3 Answers
15
Best Answer

Use this:

return {
    'type': 'ir.actions.client',
    'tag': 'reload',
}
7 Comments
Avatar
Discard
Avatar
Hannes Smit
-

Yes, that works, thanks! Do you perhaps know why this is needed?

when you will return nothing then it will it simply close that wizard and to reload you will need to pass this values.

Avatar
Hannes Smit
-

@Turky: but it seems strange to me that it (the source form view) does refresh after the first 'click' (in the darker background). What triggers that then?

Avatar
Cpueyo
-

Thanks!! It's work!

Avatar
Jos De Graeve
-

It's a pity that this reload the complete web application. Is there a way to trigger a refresh like 'button_dummy' that triggers the view to be refreshed from the DB ?

Avatar
bruno bottacini
-

i think there is only one moment the original view refresh and is when the wizard is saved that is when an ID is assigned, this happen when click on a button.

Avatar
Ronald Portier
-

Does not work here (on 6.1). With new style wizard (TransientModel).

What version are you using? Old style wizards or osv_memory/TransientModel?

8
Avatar
Petar Najman
Best Answer

Hi Hannes,

As far as I know there is no such functionality in the framework at the moment. However, you can try with the following ActionManager extension which should be defined in the JS file within your module

Here for example: 'static/src/js/your_module_name.js'

openerp.your_module_name = function (instance) {
    instance.web.ActionManager = instance.web.ActionManager.extend({

        ir_actions_act_close_wizard_and_reload_view: function (action, options) {
            if (!this.dialog) {
                options.on_close();
            }
            this.dialog_stop();
            this.inner_widget.views[this.inner_widget.active_view].controller.reload();
            return $.when();
        },
    });
}

To use this action just return following when closing a wizard:

return { 'type' :  'ir.actions.act_close_wizard_and_reload_view' }

I hope this helps :-)

Cheers, Petar

5 Comments
Avatar
Discard
Avatar
Subhin P V
-

Thanks man. that helped.. :)

Avatar
Pedro M. Baeza
-

Great trick! Thanks

@Hannes, Is it possible to create for ir.actions.clients_close that works for client window?

Avatar
Andre
-

Awesome! Thanks.

Avatar
Douglas Barbosa
-

Does anyone have a deal like this for Odoo 10?

0
Avatar
Ronald Portier
Best Answer

Does not work here (on 6.1). With new style wizard (TransientModel).

What version are you using? Old style wizards or osv_memory/TransientModel?

1 Comment
Avatar
Discard
Avatar
Hannes Smit
-

I think this was in the context of v 7