From d56a879cdd86292c15dbcf08407d1d42f21ca979 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Tue, 10 Oct 2023 11:36:24 +0200 Subject: [PATCH] [IMP] sql_export : Direct download when executing the query instead of showing wizard --- sql_export/wizard/wizard_file.py | 15 ++++++++------- sql_export/wizard/wizard_file_view.xml | 8 +------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sql_export/wizard/wizard_file.py b/sql_export/wizard/wizard_file.py index 5a99ddc264..da6e9b3313 100644 --- a/sql_export/wizard/wizard_file.py +++ b/sql_export/wizard/wizard_file.py @@ -102,11 +102,12 @@ def export_sql(self): % {"name": sql_export.name, "date": date, "extension": extension}, } ) - return { - "view_mode": "form", - "res_model": "sql.file.wizard", - "res_id": self.id, - "type": "ir.actions.act_window", - "target": "new", - "context": self.env.context, + action = { + "name": "SQL Export", + "type": "ir.actions.act_url", + "url": "web/content/?model=%s&id=%d&filename_field=filename&" + "field=binary_file&download=true&filename=%s" + % (self._name, self.id, self.file_name), + "target": "self", } + return action diff --git a/sql_export/wizard/wizard_file_view.xml b/sql_export/wizard/wizard_file_view.xml index 8ac944fbe3..b604e69d39 100644 --- a/sql_export/wizard/wizard_file_view.xml +++ b/sql_export/wizard/wizard_file_view.xml @@ -10,13 +10,7 @@ colspan="4" invisible="1" /> - - - +