I want to reload a page in odoo on a click of a button. I tried this:
object_name.refresh()
return {'tag': 'reload'}
but it's not working.
How can I get it?
Add 'type': 'ir.actions.client'
in your return like:
return {
'type': 'ir.actions.client',
'tag': 'reload',
}
Return view on button click, for that you need to call method on button click and inside that 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 button,
<button type="object" name="reload_page" string="Reload Page" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With