Odoo Reload on button click
5 answers
The returned image when the button is clicked, for this you need to call the method when the button is clicked and inside this method you need to write code like this,
@api.multi
def reload_page(self):
model_obj = self.env['ir.model.data']
data_id = model_obj._get_id('module_name', 'view_id')
view_id = model_obj.browse(data_id).res_id
return {
'type': 'ir.actions.act_window',
'name': _('String'),
'res_model': 'model.name',
'view_type' : 'tree',
'view_mode' : 'form',
'view_id' : view_id,
'target' : 'current',
'nodestroy' : True,
}
Xml code for the button,
<button type="object" name="reload_page" string="Reload Page" />
+1
source to share
you can try with ActionManager extension which should be defined in JS file in your module.
for Example : 'static/src/js/your_module_name.js'
enter below js code
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();
},
});
}
Call action to button action
return { 'type' : 'ir.actions.act_close_wizard_and_reload_view' }
Hope my answer can help you :)
0
source to share