Skip to content

Commit

Permalink
[IMP] sql_export : Direct download when executing the query instead o…
Browse files Browse the repository at this point in the history
…f showing wizard
  • Loading branch information
florian-dacosta committed Oct 10, 2023
1 parent b36d88b commit d56a879
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
15 changes: 8 additions & 7 deletions sql_export/wizard/wizard_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions sql_export/wizard/wizard_file_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@
colspan="4"
invisible="1"
/>
<separator
string="Export file"
colspan="4"
attrs="{'invisible': [('binary_file', '=', False)]}"
/>
<field name="binary_file" filename="file_name" />
<field name="file_name" invisible="1" />
<field name="sql_export_id" invisible="1" />
<footer>
<button
name="export_sql"
Expand Down

0 comments on commit d56a879

Please sign in to comment.