Odoo – Redirect user to a page in python

This code bellow will redirect the user to customer invoice page, you will be able to set the model you would like to use with res_model and the id of the record in res_id, the view template in views, target can have new or self value. new value 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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.