mail/static/tests/helpers/mock_server/mock_server.js
Данил Воробьев 6e6f15d803 initial commit
2024-05-03 09:40:35 +00:00

20 lines
664 B
JavaScript

/* @odoo-module */
import { registry } from "@web/core/registry";
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
patch(MockServer.prototype, {
async performRPC(route, args) {
const rpcResult = await super.performRPC(route, args);
const methodName = args.method || route;
const callbackFn =
registry.category("mock_server_callbacks").get(`${args.model}/${methodName}`, null) ||
registry.category("mock_server_callbacks").get(methodName, null);
if (callbackFn) {
callbackFn(args);
}
return rpcResult;
},
});