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.

39 lines
1.6 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 (_.isUndefined(action.data) || _.isNull(action.data) ||
  21. _.isObject(action.data) && _.isEmpty(action.data)) {
  22. if (action.context.active_ids) {
  23. var activeIDsPath = '/' + action.context.active_ids.join(',');
  24. reportUrls.py3o += activeIDsPath;
  25. }
  26. } else {
  27. var serializedOptionsPath = '?options=' + encodeURIComponent(JSON.stringify(action.data));
  28. serializedOptionsPath += '&context=' + encodeURIComponent(JSON.stringify(action.context));
  29. reportUrls.py3o += serializedOptionsPath;
  30. }
  31. return reportUrls;
  32. },
  33. });
  34. });