跳至內容
選單
此問題已被標幟
1 回覆
6840 瀏覽次數

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' }?

作者

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

作者 最佳答案

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

 

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
6月 19
5255
3
2月 24
12637
2
8月 22
8919
2
4月 19
9685
0
3月 25
1264