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.

38 lines
1.3 KiB

  1. // Copyright 2019 ACSONE SA/NV
  2. // License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. odoo.define("report_substitute.action_report_substitute", function (require) {
  4. "use strict";
  5. var ActionManager = require("web.ActionManager");
  6. ActionManager.include({
  7. /**
  8. * Intercept action handling substitute the report action
  9. * @override
  10. */
  11. _handleAction: function (action, options) {
  12. if (action.type === "ir.actions.report" &&
  13. action.context.active_ids &&
  14. action.action_report_substitution_rule_ids &&
  15. action.action_report_substitution_rule_ids != 0) {
  16. var active_ids = action.context.active_ids;
  17. var self = this;
  18. var _super = this._super;
  19. var callersArguments = arguments;
  20. return this._rpc({
  21. model: "ir.actions.report",
  22. method: "get_substitution_report_action",
  23. args: [action, active_ids]
  24. }).then(function (substitution_action) {
  25. callersArguments[0] = substitution_action
  26. return _super.apply(self, callersArguments);
  27. });
  28. }
  29. return this._super.apply(this, arguments);
  30. },
  31. });
  32. });