mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[16.0][IMP] report_xml: Added xml_extension
Adds a way to choose the file extension for your XML file, by adding the flexibility of appending more choices. For example, instead of getting `.xml`, this allows to have the report download as `.svg` or even good old `.html` if needed. This is also very useful for some localization purposes, where some scarce software uses uncommon file extensions for their XML files, like `.ffdata` for specific accounting reports here in Lithuania. The change is not breaking, as we set the default to be `.xml` like it was by default anyway.
This commit is contained in:
@@ -70,7 +70,7 @@ class ReportController(report.ReportController):
|
||||
report_name = safe_eval(
|
||||
report.print_report_name, {"object": obj, "time": time}
|
||||
)
|
||||
filename = f"{report_name}.xml"
|
||||
filename = f"{report_name}.{report.xml_extension}"
|
||||
else:
|
||||
data = url_parse(url).decode_query(cls=dict)
|
||||
if "context" in data:
|
||||
@@ -80,7 +80,7 @@ class ReportController(report.ReportController):
|
||||
response = self.report_routes(
|
||||
reportname, converter="xml", context=context, **data
|
||||
)
|
||||
filename = filename or f"{report.name}.xml"
|
||||
filename = filename or f"{report.name}.{report.xml_extension}"
|
||||
response.headers.add("Content-Disposition", content_disposition(filename))
|
||||
return response
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user