diff --git a/src/router/modules/ADempiere/menu.js b/src/router/modules/ADempiere/menu.js index d1b18b62bce..1527bd83941 100644 --- a/src/router/modules/ADempiere/menu.js +++ b/src/router/modules/ADempiere/menu.js @@ -22,7 +22,7 @@ import store from '@/store' import Layout from '@/layout' // Constants -import staticRoutes from '@/router/modules/ADempiere/staticRoutes.js' +import STATIC_ROUTES from '@/router/modules/ADempiere/staticRoutes.js' import { NOTICE_WINDOW_ID } from '@/utils/ADempiere/dictionary/dashboard' // API Request Methods @@ -31,7 +31,7 @@ import { requestMenu } from '@/api/ADempiere/security/index.ts' // Utils and Helper Methods import { convertAction } from '@/utils/ADempiere/dictionary/menu' import { getCurrentOrganization } from '@/utils/ADempiere/auth' -import { isEmptyValue, recursiveTreeSearch } from '@/utils/ADempiere' +import { isEmptyValue, recursiveTreeSearch } from '@/utils/ADempiere/valueUtils' /** * Get Menu from server @@ -69,7 +69,7 @@ export function loadMainMenu({ }) const children = [] - if (optionMenu.meta.isSummary) { + if (optionMenu.meta.isSummary && !isEmptyValue(menuElement.children)) { menuElement.children.forEach(menu => { const childsSumaryConverted = getChildFromAction({ menu, @@ -101,7 +101,7 @@ export function loadMainMenu({ }) const permiseStactiRoutes = hidenStaticRoutes({ dynamicRoutes: asyncRoutesMap, - staticRoutes, + staticRoutes: STATIC_ROUTES, permiseRole: role }) const menuRoutes = permiseStactiRoutes @@ -112,10 +112,10 @@ export function loadMainMenu({ resolve(menuRoutes) }).catch(error => { - console.warn(`Error getting menu: ${error.message}. Code: ${error.code}.`) + console.error(`Error getting menu: ${error.message}. Code: ${error.code}.`) const permiseStactiRoutes = hidenStaticRoutes({ dynamicRoutes: [], - staticRoutes, + staticRoutes: STATIC_ROUTES, permiseRole: role }) const menuRoutes = permiseStactiRoutes @@ -171,7 +171,7 @@ function getChildFromAction({ menu, index, clientId, roleId, organizationId }) { children: [] } - if (isIndex) { + if (isIndex && !isEmptyValue(menu.children)) { menu.children.forEach(child => { const menuConverted = getChildFromAction({ menu: child,