Skip to content

Commit dbc7e74

Browse files
committed
[MIG] report_csv: Migration to 17.0
TT52352
1 parent bfcb3a4 commit dbc7e74

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

report_csv/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Creu Blanca, Odoo Community Association (OCA)",
77
"website": "https://github.com/OCA/reporting-engine",
88
"category": "Reporting",
9-
"version": "16.0.2.1.0",
9+
"version": "17.0.1.0.0",
1010
"license": "AGPL-3",
1111
"depends": ["base", "web"],
1212
"demo": ["demo/report.xml"],

report_csv/controllers/main.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def report_routes(self, reportname, docids=None, converter=None, **data):
5252
return super().report_routes(reportname, docids, converter, **data)
5353

5454
@route()
55-
def report_download(self, data, context=None):
55+
def report_download(self, data, context=None, token=None):
5656
requestcontent = json.loads(data)
5757
url, report_type = requestcontent[0], requestcontent[1]
5858
reportname = ""
@@ -85,7 +85,7 @@ def report_download(self, data, context=None):
8585
report = request.env["ir.actions.report"]._get_report_from_name(
8686
reportname
8787
)
88-
filename = "%s.%s" % (report.name, "csv")
88+
filename = f"{report.name}.csv"
8989

9090
if docids:
9191
ids = [int(x) for x in docids.split(",")]
@@ -94,13 +94,13 @@ def report_download(self, data, context=None):
9494
report_name = safe_eval(
9595
report.print_report_name, {"object": obj, "time": time}
9696
)
97-
filename = "%s.%s" % (report_name, "csv")
97+
filename = f"{report_name}.csv"
9898
response.headers.add(
9999
"Content-Disposition", content_disposition(filename)
100100
)
101101
return response
102102
else:
103-
return super().report_download(data, context)
103+
return super().report_download(data, context, token=token)
104104
except Exception as e:
105105
_logger.exception("Error while generating report %s", reportname)
106106
se = _serialize_exception(e)

report_csv/views/ir_actions_views.xml

+2-8
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66
<field name="inherit_id" ref="base.act_report_xml_view" />
77
<field name="arch" type="xml">
88
<xpath expr="//field[@name='report_type']" position="after">
9-
<field
10-
name="encoding"
11-
attrs="{'invisible': [('report_type', '!=', 'csv')]}"
12-
/>
13-
<field
14-
name="encode_error_handling"
15-
attrs="{'invisible': [('encoding', '=', False)]}"
16-
/>
9+
<field name="encoding" invisible="report_type!='csv'" />
10+
<field name="encode_error_handling" invisible="not encoding" />
1711
</xpath>
1812
</field>
1913
</record>

0 commit comments

Comments
 (0)