How to update the original / parent view after the wizard in OpenERP?

I have a view that lists many elements. When the user selects someone, a publication wizard with advanced functionality appears. Some wizard actions close it, but the parent view is not updated, it shows old data.

I need the button action in the OpenERP wizard view to update the parent view.

I tried:

def some_action(self, cr, uid, ids, context=None): .... res = {'type':'ir.actions.act_window_close', 'auto_refresh':'1' } return res 

and tried this:

 def some_action(self, cr, uid, ids, context=None): .... win_obj = self.pool.get('ir.actions.act_window') res = win_obj.for_xml_id(cr, uid, 'parent_module', 'parent_view', context) res = {'type':'ir.actions.act_window_close', 'auto_refresh':'1' } return res 

and this:

 def some_action(self, cr, uid, ids, context=None): ... mod_obj = self.pool.get('ir.model.data') view_rec = mod_obj.get_object_reference(cr, uid, 'hr_holidays', 'open_ask_holidays') view_id = view_rec and view_rec[1] or False return { 'view_type': 'form', 'view_id' : [view_id], 'view_mode': 'form', 'res_model': 'model.obj.here', 'type': 'ir.actions.act_window', 'context': context } 

but nothing works ...

+4
source share
2 answers

The correct form:

 def some_action(self, cr, uid, ids, context=None): .... res = { 'type': 'ir.actions.client', 'tag': 'reload' } return res 

I found it here:

"How to update the original view after the wizard?" . OpenERP Knowledge Base

+6
source

Following the @yucer link, I found that you can update field values ​​without reloading the view.

 openerp.your_module_name = function (instance) { instance.web.ActionManager = instance.web.ActionManager.extend({ ir_actions_act_close_wizard_and_refresh_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(); }, }); } 

Invoke an action when closing the wizard view:

 return { 'type' : 'ir.actions.act_close_wizard_and_refresh_view' } 
+2
source

Source: https://habr.com/ru/post/1500628/


All Articles