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

Wizard didn't refresh main page in Odoo v8 or new API

By
Andre Leander
on 9/30/14, 5:05 AM 2,075 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.

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

Pau Ubach
on 10/14/14, 2:40 AM

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

Andre Leander
on 10/19/14, 9:39 PM
0
Andre Leander
On 10/19/14, 9:47 PM

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

 

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: 9/30/14, 5:05 AM
Seen: 2075 times
Last updated: 3/16/15, 8:10 AM