Odoo – Redirect user to a page in python

This code bellow will redirect the user to customer invoice page, set the model you would like to use in res_model, the id of the record in res_id, the view template in views, target can have new or self value. new will open a popup and display the requested page, self will load the page in the current window.

return {
            'type': 'ir.actions.act_window',
            'res_model': 'account.invoice',
            'view_mode': 'form',
            'view_type': 'form',
            'res_id': invoice_id.id,
            'views': [(self.env.ref('account.invoice_form').id, 'form')],
            'target': 'new',
             }

Leave a Reply

Your email address will not be published. Required fields are marked *