mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] report_substitute: Migration to 15.0
This commit is contained in:
29
report_substitute/static/src/js/action_manager.esm.js
Normal file
29
report_substitute/static/src/js/action_manager.esm.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
registry
|
||||
.category("ir.actions.report handlers")
|
||||
.add("sustitution_handler", async function (action, options, env) {
|
||||
const orm = env.services.orm;
|
||||
const action_report_substitution_rule_ids = await orm.call(
|
||||
"ir.actions.report",
|
||||
"get_action_report_substitution_rule_ids",
|
||||
[action.id]
|
||||
);
|
||||
if (
|
||||
action.type === "ir.actions.report" &&
|
||||
action.context.active_ids &&
|
||||
action_report_substitution_rule_ids &&
|
||||
action_report_substitution_rule_ids.length !== 0
|
||||
) {
|
||||
var active_ids = action.context.active_ids;
|
||||
const substitution = await orm.call(
|
||||
"ir.actions.report",
|
||||
"get_substitution_report_action",
|
||||
[action, active_ids]
|
||||
);
|
||||
Object.assign(action, substitution);
|
||||
}
|
||||
return Promise.resolve(false);
|
||||
});
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright 2019 ACSONE SA/NV
|
||||
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
odoo.define("report_substitute.action_report_substitute", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ActionManager = require("web.ActionManager");
|
||||
|
||||
ActionManager.include({
|
||||
/**
|
||||
* Intercept action handling substitute the report action
|
||||
* @override
|
||||
*/
|
||||
|
||||
_handleAction: function(action, options) {
|
||||
if (
|
||||
action.type === "ir.actions.report" &&
|
||||
action.context.active_ids &&
|
||||
action.action_report_substitution_rule_ids &&
|
||||
action.action_report_substitution_rule_ids !== 0
|
||||
) {
|
||||
var active_ids = action.context.active_ids;
|
||||
var self = this;
|
||||
var _super = this._super;
|
||||
return this._rpc({
|
||||
model: "ir.actions.report",
|
||||
method: "get_substitution_report_action",
|
||||
args: [action, active_ids],
|
||||
}).then(function(substitution_action) {
|
||||
return _super.apply(self, [substitution_action, options]);
|
||||
});
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user