move code in init file, remove menu helpers

This commit is contained in:
Géry Debongnie
2019-02-05 16:08:35 +01:00
parent abbf077977
commit 5f49f82a04
5 changed files with 198 additions and 198 deletions
+6 -10
View File
@@ -1,23 +1,19 @@
///<amd-module name="main" />
import { makeEnvironment } from "./env";
import { BaseMenuItem, processMenuItems } from "./misc/menu_helpers";
import { init } from "./init";
import { Root } from "./widgets/root";
//------------------------------------------------------------------------------
// Application bootstrapping
// Web Client Bootstrapping
//------------------------------------------------------------------------------
document.addEventListener("DOMContentLoaded", async function() {
const env = await makeEnvironment();
const { env, menuInfo } = await init();
// menu processing
const menuItems: BaseMenuItem[] = (<any>window).odoo.menus;
const menuInfo = processMenuItems(menuItems);
delete (<any>window).odoo.menus; // overkill?
// creating root widget
// Creating root widget
const rootWidget = new Root(env, { menuInfo });
await rootWidget.mount(document.body);
// For debugging purpose, we keep a reference to the root widget in odoo
(<any>window).odoo.rootWidget = rootWidget;
});