Odoo Reload on button click

10,394

Solution 1

add 'type': 'ir.actions.client' in your return like:

return {
      'type': 'ir.actions.client',
      'tag': 'reload',
}

Solution 2

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" />
Share:
10,394
deepika bhojani
Author by

deepika bhojani

Updated on June 06, 2022

Comments

  • deepika bhojani
    deepika bhojani about 2 years

    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?