diff --git a/src/api/ADempiere/dictionary/window.ts b/src/api/ADempiere/dictionary/window.ts index 97db1566e0..03fa2b5d51 100644 --- a/src/api/ADempiere/dictionary/window.ts +++ b/src/api/ADempiere/dictionary/window.ts @@ -17,6 +17,7 @@ */ // Get Instance for connection +import { isEmptyValue } from '@/utils/ADempiere' import { request } from '@/utils/ADempiere/request' /** @@ -41,4 +42,11 @@ export function requestWindowMetadata({ user_id: userId } }) + .then(windowResponse => { + const { convertWindow } = require('@/utils/ADempiere/apiConverts/dictionary.js') + if (isEmptyValue(windowResponse.tabs)) { + return 'error' + } + return convertWindow(windowResponse) + }) } diff --git a/src/lang/ADempiere/en/index.js b/src/lang/ADempiere/en/index.js index 0bcda2a887..ada432c06a 100644 --- a/src/lang/ADempiere/en/index.js +++ b/src/lang/ADempiere/en/index.js @@ -227,6 +227,7 @@ export default { notice: 'Notice', request: 'Request', workflowActivities: 'Workflow Activities', + roleMessage: 'You cannot see this information with your current role', systemInformation: { tabLabel: 'System Information', releaseNumber: 'Release', diff --git a/src/lang/ADempiere/es/index.js b/src/lang/ADempiere/es/index.js index e9a1debbaa..6f147a6174 100644 --- a/src/lang/ADempiere/es/index.js +++ b/src/lang/ADempiere/es/index.js @@ -228,6 +228,7 @@ export default { notice: 'Avisos', request: 'Solicitudes', workflowActivities: 'Flujos de Trabajo', + roleMessage: 'No se puede ver esta información con su rol actual', systemInformation: { tabLabel: 'Información de Sistema', releaseNumber: 'Número de versión', diff --git a/src/store/modules/ADempiere/dictionary/window/actions.js b/src/store/modules/ADempiere/dictionary/window/actions.js index 5c613a0cc2..496470ff2c 100644 --- a/src/store/modules/ADempiere/dictionary/window/actions.js +++ b/src/store/modules/ADempiere/dictionary/window/actions.js @@ -109,9 +109,17 @@ export default { userId }) .then(async windowResponse => { + if (windowResponse === 'error') { + // show the error message + showMessage({ + type: 'error', + message: language.t('profile.roleMessage') + }) + navigateBack() + return + } const window = generateWindow(windowResponse) dispatch('addWindow', window) - resolve(window) }) .catch(error => { @@ -119,19 +127,21 @@ export default { type: 'error', message: error.message }) - - // close current page - const currentRoute = router.app._route - const tabViewsVisited = rootGetters.visitedViews - dispatch('tagsView/delView', currentRoute) - // go to back page - const oldRouter = tabViewsVisited[tabViewsVisited.length - 1] - if (!isEmptyValue(oldRouter)) { - router.push({ - path: oldRouter.path - }, () => {}) - } + navigateBack() + return }) + function navigateBack() { + const currentRoute = router.app._route + const tabViewsVisited = rootGetters.visitedViews + dispatch('tagsView/delView', currentRoute) + // go to back page + const oldRouter = tabViewsVisited[tabViewsVisited.length - 1] + if (!isEmptyValue(oldRouter)) { + router.push({ + path: oldRouter.path + }, () => {}) + } + } }) },