DEV Community

Jeevachaithanyan Sivanandan
Jeevachaithanyan Sivanandan

Posted on

Odoo : how to create a Wizard with download a file and auto close

how to create a Wizard with download a file and auto close

  1. assuming you already have the method to create the file, after the logic of the file creation, you can write return statement as below
        return {
            'type': 'ir.actions.act_url',
            'url': f"/web/content/?model=model_of_the_wizard_&id={self.id}&field=csv_file&download=true&filename=then_name_of_file.csv",
            'target': 'self',
            'next': {'type': 'ir.actions.act_window_close'},
        }
Enter fullscreen mode Exit fullscreen mode

this line

'next': {'type': 'ir.actions.act_window_close'},
Enter fullscreen mode Exit fullscreen mode

will auto close the wizard after the download

Top comments (0)