OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1000 B

  1. # -*- encoding: utf-8 -*-
  2. # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
  3. from openerp.http import route
  4. from openerp.addons.report.controllers import main as report
  5. class ReportController(report.ReportController):
  6. @route()
  7. def report_routes(self, reportname, docids=None, converter=None, **data):
  8. # Trick the main reporter to think we want an HTML report
  9. new_converter = converter if converter != "xml" else "html"
  10. response = super(ReportController, self).report_routes(
  11. reportname, docids, new_converter, **data)
  12. # If it was an XML report, just download the generated response
  13. if converter == "xml":
  14. # XML header must be before any spaces, and it is a common error,
  15. # so let's fix that here and make developers happier
  16. response.data = response.data.strip()
  17. # XML files should be downloaded
  18. response.headers.set("Content-Type", "text/xml")
  19. return response