콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
10 답글
30504 화면

Consider there is a form view say sale order. In sale order , there is a button which is not in its header...call button A. When button A clicks, it pop ups the wizard, wizard consists of a button say B. B having some functionality to update in the master or source record ie, in sale order. So when B clicks, it executes the function and wizard gets closed.

So my requirement is button B should not close the wizard after executing the function and source/ master record gets refreshed(source record: sale order form) in the button action itself.

아바타
취소
베스트 답변

Hi Jasad,

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

아바타
취소

Thanks Man. That Helped.. :)

This action close works for ir.actions.act_window but not work for ir.actions.client? How to close the ir.actions.client to close? Thanks in advance.

베스트 답변

FOR VERSION 13 2020

    ActionManager.include({

        _handleAction: function (action, options) {

            if (action.type === 'ir.actions.act_close_wizard_and_reload_attachments') {

                return this.ir_actions_act_close_wizard_and_reload_attachments();

            }

            return this._super(action, options);

        },


        ir_actions_act_close_wizard_and_reload_attachments: function (action, options) {

           this._closeDialog();

           //this.getCurrentController().widget.renderer.chatter._onReloadAttachmentBox();
            //reload your own object view or widget

        },

    });

in python
      return {'type': 'ir.actions.act_close_wizard_and_reload_attachments'}

아바타
취소
베스트 답변

use this

return {
    'type': 'ir.actions.client',
    'tag': 'reload',  }
아바타
취소
작성자

Hi Sayed, This will reload the entire application. I dont want to do so. Just refreshing the main window.

베스트 답변

I have gone from OpenERP 6.1 to Odoo11.
In OpenERP, nothing special was needed.
In Odoo11 I tried what he says Alexandro, but I do not get the expected performance.
Is there any way to get it in Odoo11?

아바타
취소

Hi Isidre,

This action was eventually converted into it's own module (``web_ir_actions_act_view_reload``) over at OCA github repository: https://github.com/OCA/web

You can use it with Odoo versions 11.0 and 12.0.

Kind Reagards,

Petar

베스트 답변

Not working on odoo v9:

Action manager can't handle action of type ir.actions.act_close_wizard_and_refresh_view

  1. {flags: {…}, type: "ir.actions.act_close_wizard_and_refresh_view", context: {…}, menu_id: null}
    1. context:
      1. active_id:3
      2. active_ids:Array(1)
        1. 0:3
        2. length:1
        3. __proto__:Array(0)
      3. active_model:"sale.manage.variant"
      4. lang:"es_AR"
      5. params:{action318id9view_type"form"model"sale.order"_push_mefalse}
      6. search_disable_custom_filters:true
      7. tz:"Europe/Brussels"
      8. uid:1
      9. __proto__:Object
    2. flags:
      1. __proto__:Object
    3. menu_id:null
    4. type:"ir.actions.act_close_wizard_and_refresh_view"
    5. __proto__:
      1. constructor:ƒ Object()
      2. hasOwnProperty:ƒ hasOwnProperty()
      3. isPrototypeOf:ƒ isPrototypeOf()
      4. propertyIsEnumerable:ƒ propertyIsEnumerable()
      5. toLocaleString:ƒ toLocaleString()
      6. toString:ƒ toString()
      7. valueOf:ƒ valueOf()
      8. __defineGetter__:ƒ __defineGetter__()
      9. __defineSetter__:ƒ __defineSetter__()
      10. __lookupGetter__:ƒ __lookupGetter__()
      11. __lookupSetter__:ƒ __lookupSetter__()
      12. get __proto__:ƒ __proto__()
      13. set __proto__:ƒ __proto__()


Any idea why the action is not called?

아바타
취소
베스트 답변

Continuing the work mentioned previously, the following works on Odoo 9:


odoo.define('my_module.action_manager', function(require) { 
  var action_manager = require('web.ActionManager');
  var MyModuleActionManager = action_manager.include({
    ir_actions_act_close_wizard_and_reload_view: function (action, options) {
      if (!this.dialog) {
        options.on_close();
      }
      this.dialog_stop();
      this.inner_widget.active_view.controller.do_reload();
      return $.when();
    },
  });
  return MyModuleActionManager; });
아바타
취소
관련 게시물 답글 화면 활동
0
1월 25
1226
1
3월 21
4690
1
11월 16
5898
1
3월 15
5508
3
3월 15
9816