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.

42 lines
1.7 KiB

  1. /* Copyright 2017-2018 ACSONE SA/NV
  2. * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
  3. odoo.define("report_py3o.report", function(require) {
  4. "use strict";
  5. var ActionManager = require("web.ActionManager");
  6. ActionManager.include({
  7. _executeReportAction: function(action, options) {
  8. // Py3o reports
  9. if ("report_type" in action && action.report_type === "py3o") {
  10. return this._triggerDownload(action, options, "py3o");
  11. }
  12. return this._super.apply(this, arguments);
  13. },
  14. _makeReportUrls: function(action) {
  15. var reportUrls = this._super.apply(this, arguments);
  16. reportUrls.py3o = "/report/py3o/" + action.report_name;
  17. // We may have to build a query string with `action.data`. It's the place
  18. // were report's using a wizard to customize the output traditionally put
  19. // their options.
  20. if (
  21. _.isUndefined(action.data) ||
  22. _.isNull(action.data) ||
  23. (_.isObject(action.data) && _.isEmpty(action.data))
  24. ) {
  25. if (action.context.active_ids) {
  26. var activeIDsPath = "/" + action.context.active_ids.join(",");
  27. reportUrls.py3o += activeIDsPath;
  28. }
  29. } else {
  30. var serializedOptionsPath =
  31. "?options=" + encodeURIComponent(JSON.stringify(action.data));
  32. serializedOptionsPath +=
  33. "&context=" + encodeURIComponent(JSON.stringify(action.context));
  34. reportUrls.py3o += serializedOptionsPath;
  35. }
  36. return reportUrls;
  37. },
  38. });
  39. });