Skip to Content
Menu
This question has been flagged
1 Reply
6197 Views

I have developed a wizard in my new module. In OpenERP v7 the wizard will refresh the main form after it closed. 

I used return {'type': 'ir.actions.act_window_close'} to close the wizard. But in Odoo v8, it do not refresh. I have read some forum with same problem and they used return {'type': 'ir.actions.client', 'tag': 'reload' } to reload page. But it make the process heavy and need extra time. Any solution or advice for this problem ? Thank you for your best help.

Avatar
Discard

If by main form you mean the one in your home page, have you tried: {'type': 'ir.actions.client', 'tag': 'home' }?

Author

No.. I mean main form is the current form :D.. I have gotten the answer. I will post below.. Thank u Pau.

Author Best Answer

I have got the anwer with these steps:

  1. Create a new javascript file in static>src>js.
  2. Copy code below: 

openerp.yout_module = 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();
        },
    });
}

3. Link your js file to your module with file your_module_name.xml in views folder.

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="assets_backend" name="your_module_name assets" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
            <script type="text/javascript" src="/your_module_name/static/src/js/your_js_file_name.js"></script>
        </xpath>
        </template>
    </data>
</open

4. Add your your_module_name.xml to __openerp__.py file

 

Avatar
Discard
Related Posts Replies Views Activity
3
Jun 19
4793
3
Feb 24
12113
2
Aug 22
8285
2
Apr 19
8814
0
Mar 25
420