DEV Community

Jeevachaithanyan Sivanandan
Jeevachaithanyan Sivanandan

Posted on

5 1 1 1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay