mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-19 04:12:03 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
37
odoo-bringout-oca-ocb-web/web/static/tests/helpers/legacy.js
Normal file
37
odoo-bringout-oca-ocb-web/web/static/tests/helpers/legacy.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
odoo.define("web.SessionOverrideForTests", (require) => {
|
||||
// Override the Session.session_reload function
|
||||
// The wowl test infrastructure does set a correct odoo global value before each test
|
||||
// while the session is built only once for all tests.
|
||||
// So if a test does a session_reload, it will merge the odoo global of that test
|
||||
// into the session, and will alter every subsequent test of the suite.
|
||||
// Obviously, we don't want that, ever.
|
||||
const { session: sessionInfo } = require("@web/session");
|
||||
const initialSessionInfo = Object.assign({}, sessionInfo);
|
||||
const Session = require("web.Session");
|
||||
const { patch } = require("@web/core/utils/patch");
|
||||
patch(Session.prototype, "web.SessionTestPatch", {
|
||||
async session_reload() {
|
||||
for (const key in sessionInfo) {
|
||||
delete sessionInfo[key];
|
||||
}
|
||||
for (const key in initialSessionInfo) {
|
||||
sessionInfo[key] = initialSessionInfo[key];
|
||||
}
|
||||
return await this._super(...arguments);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
odoo.define("web.test_legacy", async (require) => {
|
||||
require("web.SessionOverrideForTests");
|
||||
require("web.test_utils");
|
||||
const session = require("web.session");
|
||||
await session.is_bound; // await for templates from server
|
||||
|
||||
const FormView = require("web.FormView");
|
||||
const ListView = require("web.ListView");
|
||||
const viewRegistry = require("web.view_registry");
|
||||
viewRegistry.add("legacy_form", FormView).add("legacy_list", ListView);
|
||||
|
||||
return { legacyProm: session.is_bound };
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue