From 9bc15fdd9cf75e0dc406065416aaa7516fbe0a41 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:24:46 -0400 Subject: [PATCH 1/8] Support Multi Tentants (#2392) --- src/api/ADempiere/dictionary/window.ts | 12 +++--------- src/api/ADempiere/security/index.ts | 8 ++++++-- src/components/ADempiere/PanelInfo/index.vue | 2 +- src/components/ADempiere/TabManager/index.vue | 2 +- src/router/modules/ADempiere/menu.js | 12 +++++++----- src/store/modules/ADempiere/panel/actions.js | 2 +- src/store/modules/ADempiere/windowManager.js | 4 ++-- .../ADempiere/dictionary/browser/templateBrowser.js | 4 +++- src/utils/ADempiere/dictionary/window/index.js | 1 + .../ADempiere/dictionary/window/templatesWindow.js | 8 +++----- src/views/ADempiere/Browser/index.vue | 5 +++-- src/views/ADempiere/Window/index.vue | 2 +- 12 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/api/ADempiere/dictionary/window.ts b/src/api/ADempiere/dictionary/window.ts index b98fb56809..9216ff01b4 100644 --- a/src/api/ADempiere/dictionary/window.ts +++ b/src/api/ADempiere/dictionary/window.ts @@ -22,23 +22,17 @@ import { request } from '@/utils/ADempiere/request' /** * Request dictionary Window metadata * @param {number} id, identifier + * @param {string} language */ export function requestWindowMetadata({ id, - // mandatory to open search - language, - clientId, - roleId, - userId + language }) { return request({ url: `/dictionary/windows/${id}`, method: 'get', params: { - language, - client_id: clientId, - role_id: roleId, - user_id: userId + language } }) } diff --git a/src/api/ADempiere/security/index.ts b/src/api/ADempiere/security/index.ts index c787ba1b72..6e5520b47c 100644 --- a/src/api/ADempiere/security/index.ts +++ b/src/api/ADempiere/security/index.ts @@ -139,12 +139,16 @@ export function requestChangeRole({ /** * GET Menu + * @param {string} language + * @param {string} clientId + * @param {string} roleId + * @param {string} userUuid */ export function requestMenu({ language, clientId, roleId, - userId + userUuid }) { return request({ url: '/security/menus', @@ -153,7 +157,7 @@ export function requestMenu({ language, role_id: roleId, client_id: clientId, - user_id: userId, + user_id: userUuid, page_size: 100 } }) diff --git a/src/components/ADempiere/PanelInfo/index.vue b/src/components/ADempiere/PanelInfo/index.vue index 8f7cbea81e..40b4dbc447 100644 --- a/src/components/ADempiere/PanelInfo/index.vue +++ b/src/components/ADempiere/PanelInfo/index.vue @@ -442,7 +442,7 @@ export default defineComponent({ if (isEmptyValue(dashboardList)) { store.dispatch('listWindowDashboard', { tabId: currentTab.id, - windowId: storedWindow.value.id, + windowId: storedWindow.value.internal_id, recordId: currentRecordId.value, tableName: currentTab.table_name }) diff --git a/src/components/ADempiere/TabManager/index.vue b/src/components/ADempiere/TabManager/index.vue index b22e0af64a..5c10e1fd88 100644 --- a/src/components/ADempiere/TabManager/index.vue +++ b/src/components/ADempiere/TabManager/index.vue @@ -856,7 +856,7 @@ export default defineComponent({ } store.dispatch('isWindowDashboard', { tabId: currentTab.id, - windowId: storedWindow.id + windowId: storedWindow.internal_id }) .then(responseDashboard => { if (responseDashboard > 0) { diff --git a/src/router/modules/ADempiere/menu.js b/src/router/modules/ADempiere/menu.js index 1c27989fe1..d4abdf473e 100644 --- a/src/router/modules/ADempiere/menu.js +++ b/src/router/modules/ADempiere/menu.js @@ -30,7 +30,7 @@ import { requestMenu } from '@/api/ADempiere/security/index.ts' // Utils and Helper Methods import { convertAction } from '@/utils/ADempiere/dictionary/menu' -import { getCurrentClient, getCurrentOrganization, getCurrentRole } from '@/utils/ADempiere/auth' +import { getCurrentOrganization } from '@/utils/ADempiere/auth' import { isEmptyValue, recursiveTreeSearch } from '@/utils/ADempiere' /** @@ -44,8 +44,9 @@ export function loadMainMenu({ role }) { const language = store.getters['getCurrentLanguage'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() + // const { uuid, client } = store.getters['user/getRole'] + const clientId = store.getters['user/getRole'].client.uuid + const roleId = store.getters['user/getRole'].uuid const userId = store.getters['user/getUserId'] const organizationId = getCurrentOrganization() @@ -182,6 +183,7 @@ function getChildFromAction({ menu, index, clientId, roleId, organizationId }) { option.meta.childs.push(menuConverted) }) } + // console.log({ option }, option.meta.title) return option } @@ -196,7 +198,7 @@ function getChildFromAction({ menu, index, clientId, roleId, organizationId }) { * @param {number} organizationId */ function getRouteFromMenuItem({ menu, clientId, roleId, organizationId }) { - const { action, action_id, action_uuid } = menu + const { action, action_id, action_uuid, internal_id } = menu // use component of convertAction const { icon, name: type } = convertAction(action) @@ -216,7 +218,7 @@ function getRouteFromMenuItem({ menu, clientId, roleId, organizationId }) { parentId: menu.parent_id, // parentUuid: menu.parent_uuid, noCache: true, - id: action_id, + id: internal_id, uuid: action_uuid, action_id: action_id, action_uuid: action_uuid, diff --git a/src/store/modules/ADempiere/panel/actions.js b/src/store/modules/ADempiere/panel/actions.js index 63e420faee..6fe698a04c 100644 --- a/src/store/modules/ADempiere/panel/actions.js +++ b/src/store/modules/ADempiere/panel/actions.js @@ -476,7 +476,7 @@ const actions = { containerUuid = field.containerUuid } else { // new implementation - fieldId = fieldDependentDefinition.id + fieldId = fieldDependentDefinition.internal_id columnName = fieldDependentDefinition.column_name containerUuid = fieldDependentDefinition.parent_uuid containerName = fieldDependentDefinition.parent_name diff --git a/src/store/modules/ADempiere/windowManager.js b/src/store/modules/ADempiere/windowManager.js index 548e563940..515b983e24 100644 --- a/src/store/modules/ADempiere/windowManager.js +++ b/src/store/modules/ADempiere/windowManager.js @@ -296,7 +296,7 @@ const windowManager = { isParentTab, is_has_tree, fieldsList, - id, + internal_id, table_name, link_column_name, parent_column_name, @@ -467,7 +467,7 @@ const windowManager = { } requestGetEntities({ - tabId: id, + tabId: internal_id, contextAttributes, searchValue, referenceUuid, diff --git a/src/utils/ADempiere/dictionary/browser/templateBrowser.js b/src/utils/ADempiere/dictionary/browser/templateBrowser.js index 8ee4287191..c4656768e1 100644 --- a/src/utils/ADempiere/dictionary/browser/templateBrowser.js +++ b/src/utils/ADempiere/dictionary/browser/templateBrowser.js @@ -26,12 +26,14 @@ export function templateBrowser(browser) { const { fields, table_name, + internal_id, context_column_names } = browser return { ...browser, - tableName: table_name, fields: fields, + id: internal_id, + tableName: table_name, contextColumnNames: context_column_names } } diff --git a/src/utils/ADempiere/dictionary/window/index.js b/src/utils/ADempiere/dictionary/window/index.js index 0a4a53e811..cbf0d6a578 100644 --- a/src/utils/ADempiere/dictionary/window/index.js +++ b/src/utils/ADempiere/dictionary/window/index.js @@ -1472,6 +1472,7 @@ export function generateTabs({ const tab = { ...currentTab, parentUuid, + id: currentTab.internal_id, containerUuid: currentTab.uuid, tabGroup: currentTab.fieldGroup, firstTabUuid, diff --git a/src/utils/ADempiere/dictionary/window/templatesWindow.js b/src/utils/ADempiere/dictionary/window/templatesWindow.js index a6aaec59ed..f2ce11c57e 100644 --- a/src/utils/ADempiere/dictionary/window/templatesWindow.js +++ b/src/utils/ADempiere/dictionary/window/templatesWindow.js @@ -29,24 +29,22 @@ export function templateFields(field) { default_value_to, is_query_criteria, element_column_name, + internal_id, context_column_names } = field return { ...field, + id: internal_id, + isDisplayed: true, isAdvancedQuery: false, columnName: column_name, displayType: display_type, - isDisplayed: true, isMandatory: is_mandatory, defaultValue: default_value, default_value_to: default_value_to, isQueryCriteria: is_query_criteria, elementColumnName: element_column_name, contextColumnNames: context_column_names - // reference: { - // tableName: '', - // contextColumnNames: context_column_names - // } } } diff --git a/src/views/ADempiere/Browser/index.vue b/src/views/ADempiere/Browser/index.vue index b6cb1bc31b..a95f1b5d61 100644 --- a/src/views/ADempiere/Browser/index.vue +++ b/src/views/ADempiere/Browser/index.vue @@ -145,7 +145,7 @@ export default defineComponent({ let browserId = -1 // set uuid with linked menu if (!isEmptyValue(root.$route.meta) && !isEmptyValue(root.$route.meta.uuid)) { - browserId = root.$route.meta.id.toString() + browserId = root.$route.meta.action_uuid.toString() } // set uuid from associated browser without menu if (!isEmptyValue(root.$route.params) && !isEmptyValue(root.$route.params.browserId)) { @@ -165,7 +165,8 @@ export default defineComponent({ }) const storedBrowser = computed(() => { - return store.getters.getStoredBrowser(browserUuid.value) + const uuid = isEmptyValue(browserUuid.value) ? browserId : browserUuid.value + return store.getters.getStoredBrowser(uuid) }) const isLoaded = computed(() => { diff --git a/src/views/ADempiere/Window/index.vue b/src/views/ADempiere/Window/index.vue index 0901d43058..f265fa5205 100644 --- a/src/views/ADempiere/Window/index.vue +++ b/src/views/ADempiere/Window/index.vue @@ -151,7 +151,7 @@ export default defineComponent({ }) } store.dispatch('getWindowDefinitionFromServer', { - id: root.$route.meta.id + id: root.$route.meta.action_uuid }) .then(windowResponse => { // add apps properties From 00ffb445dd58ad9c1ee37bc7159f89637278ea38 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Mon, 15 Jul 2024 20:46:03 -0400 Subject: [PATCH 2/8] feat: Add `Dictionary Corde` to get dictionary entity. (#2449) --- .../dictionary/{window.js => form.js} | 29 ++++++---- src/api/ADempiere/dictionary/index.ts | 54 ------------------- src/api/ADempiere/dictionary/process.js | 51 ++++++++++++++++++ src/api/ADempiere/dictionary/smart-browser.js | 6 ++- src/api/ADempiere/dictionary/window.ts | 22 +++++--- .../ADempiere/dictionary/browser/actions.js | 9 ++-- .../ADempiere/dictionary/process/actions.js | 4 +- .../ADempiere/dictionary/report/actions.js | 4 +- .../ADempiere/dictionary/window/actions.js | 2 + src/store/modules/ADempiere/formDefinition.js | 4 +- src/store/modules/user.js | 9 ++++ 11 files changed, 112 insertions(+), 82 deletions(-) rename src/api/ADempiere/dictionary/{window.js => form.js} (73%) create mode 100644 src/api/ADempiere/dictionary/process.js diff --git a/src/api/ADempiere/dictionary/window.js b/src/api/ADempiere/dictionary/form.js similarity index 73% rename from src/api/ADempiere/dictionary/window.js rename to src/api/ADempiere/dictionary/form.js index 6aaaf8c51b..bcb33d0861 100644 --- a/src/api/ADempiere/dictionary/window.js +++ b/src/api/ADempiere/dictionary/form.js @@ -19,21 +19,28 @@ // Get Instance for connection import { request } from '@/utils/ADempiere/request' -export function requestReference({ - uuid, - columnName +/** + * Request dictionary Forms metadata + * @param {number} id, identifier + */ +export function requestForm({ + id: uuid, + // mandatory to open search + language, + dictionaryCode, + clientId, + roleId, + userId }) { return request({ - url: '/dictionary/reference', + url: `/dictionary/forms/${uuid}`, method: 'get', params: { - uuid, - column_name: columnName + language, + dictionary_code: dictionaryCode, + client_id: clientId, + role_id: roleId, + user_id: userId } }) - .then(validationResponse => { - const { convertReference } = require('@/utils/ADempiere/apiConverts/field.js') - - return convertReference(validationResponse) - }) } diff --git a/src/api/ADempiere/dictionary/index.ts b/src/api/ADempiere/dictionary/index.ts index 3e6749cf8e..e0c51d5f9e 100644 --- a/src/api/ADempiere/dictionary/index.ts +++ b/src/api/ADempiere/dictionary/index.ts @@ -41,59 +41,6 @@ export function requestReference({ }) } -/** - * GET Process or Report dictionary metadata definition - * @param {Number} id identifier - * @param {String} language language - * @param {Number} clientId client identifier - * @param {Number} roleId role identifier - * @param {Number} userId user identifier - * @returns - */ -export function requestProcessMetadata({ - id, - // mandatory to open search - language, - clientId, - roleId, - userId -}) { - return request({ - url: `/dictionary/processes/${id}`, - method: 'get', - params: { - language, - client_id: clientId, - role_id: roleId, - user_id: userId - } - }) -} - -/** - * Request dictionary Forms metadata - * @param {number} id, identifier - */ -export function requestForm({ - id, - // mandatory to open search - language, - clientId, - roleId, - userId -}) { - return request({ - url: `/dictionary/forms/${id}`, - method: 'get', - params: { - language, - client_id: clientId, - role_id: roleId, - user_id: userId - } - }) -} - /** * Reques GET Search Info Fields */ @@ -116,4 +63,3 @@ export function tableSearchFields({ } }) } - diff --git a/src/api/ADempiere/dictionary/process.js b/src/api/ADempiere/dictionary/process.js new file mode 100644 index 0000000000..203fe09f2d --- /dev/null +++ b/src/api/ADempiere/dictionary/process.js @@ -0,0 +1,51 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +/** + * GET Process or Report dictionary metadata definition + * @param {Number} id identifier + * @param {String} language language + * @param {Number} clientId client identifier + * @param {Number} roleId role identifier + * @param {Number} userId user identifier + * @returns + */ +export function requestProcessMetadata({ + id: uuid, + // mandatory to open search + language, + dictionaryCode, + clientId, + roleId, + userId +}) { + return request({ + url: `/dictionary/processes/${uuid}`, + method: 'get', + params: { + language, + dictionary_code: dictionaryCode, + client_id: clientId, + role_id: roleId, + user_id: userId + } + }) +} diff --git a/src/api/ADempiere/dictionary/smart-browser.js b/src/api/ADempiere/dictionary/smart-browser.js index 708bc74d99..994d1f9e91 100644 --- a/src/api/ADempiere/dictionary/smart-browser.js +++ b/src/api/ADempiere/dictionary/smart-browser.js @@ -25,17 +25,19 @@ import { request } from '@/utils/ADempiere/request' * @param {number} id, identifier */ export function requestBrowserMetadata({ - id, + id: uuid, language, + dictionaryCode, clientId, roleId, userId }) { return request({ - url: `/dictionary/browsers/${id}`, + url: `/dictionary/browsers/${uuid}`, method: 'get', params: { language, + dictionary_code: dictionaryCode, client_id: clientId, role_id: roleId, user_id: userId diff --git a/src/api/ADempiere/dictionary/window.ts b/src/api/ADempiere/dictionary/window.ts index 9216ff01b4..f42af00edc 100644 --- a/src/api/ADempiere/dictionary/window.ts +++ b/src/api/ADempiere/dictionary/window.ts @@ -25,14 +25,16 @@ import { request } from '@/utils/ADempiere/request' * @param {string} language */ export function requestWindowMetadata({ - id, - language + id: uuid, + language, + dictionaryCode }) { return request({ - url: `/dictionary/windows/${id}`, + url: `/dictionary/windows/${uuid}`, method: 'get', params: { - language + language, + dictionary_code: dictionaryCode } }) } @@ -42,11 +44,15 @@ export function requestWindowMetadata({ * @param {number} id */ export function requestTabMetadata({ - id, - windowId + id: uuid, + windowId, + dictionaryCode }) { return request({ - url: `/dictionary/windows/${windowId}/tabs/${id}`, - method: 'get' + url: `/dictionary/windows/${windowId}/tabs/${uuid}`, + method: 'get', + params: { + dictionary_code: dictionaryCode + } }) } diff --git a/src/store/modules/ADempiere/dictionary/browser/actions.js b/src/store/modules/ADempiere/dictionary/browser/actions.js index b3f0fc2883..023e585ee1 100644 --- a/src/store/modules/ADempiere/dictionary/browser/actions.js +++ b/src/store/modules/ADempiere/dictionary/browser/actions.js @@ -59,15 +59,18 @@ export default { }) { return new Promise(resolve => { const language = rootGetters['getCurrentLanguage'] + const dictionaryCode = rootGetters['user/getDictionaryCode'] const clientId = getCurrentClient() const roleId = getCurrentRole() const userId = rootGetters['user/getUserId'] + requestBrowserMetadata({ id, - roleId, - userId, language, - clientId + dictionaryCode, + clientId, + roleId, + userId }) .then(browserResponse => { const browser = templateBrowser(browserResponse) diff --git a/src/store/modules/ADempiere/dictionary/process/actions.js b/src/store/modules/ADempiere/dictionary/process/actions.js index fb6addfe6a..63ece52a05 100644 --- a/src/store/modules/ADempiere/dictionary/process/actions.js +++ b/src/store/modules/ADempiere/dictionary/process/actions.js @@ -17,7 +17,7 @@ */ // API Request Methods -import { requestProcessMetadata } from '@/api/ADempiere/dictionary/index.ts' +import { requestProcessMetadata } from '@/api/ADempiere/dictionary/process' // Constants import { @@ -64,6 +64,7 @@ export default { containerUuidAssociated }) { const language = rootGetters['getCurrentLanguage'] + const dictionaryCode = rootGetters['user/getDictionaryCode'] const clientId = getCurrentClient() const roleId = getCurrentRole() const userId = rootGetters['user/getUserId'] @@ -72,6 +73,7 @@ export default { requestProcessMetadata({ id, language, + dictionaryCode, clientId, roleId, userId diff --git a/src/store/modules/ADempiere/dictionary/report/actions.js b/src/store/modules/ADempiere/dictionary/report/actions.js index f05621fd56..c7605f333e 100644 --- a/src/store/modules/ADempiere/dictionary/report/actions.js +++ b/src/store/modules/ADempiere/dictionary/report/actions.js @@ -20,7 +20,7 @@ import router from '@/router' import store from '@/store' // API Request Methods -import { requestProcessMetadata as requestReportMetadata } from '@/api/ADempiere/dictionary/index.ts' +import { requestProcessMetadata as requestReportMetadata } from '@/api/ADempiere/dictionary/process' // Constants import { @@ -73,6 +73,7 @@ export default { }) { return new Promise((resolve, reject) => { const language = rootGetters['getCurrentLanguage'] + const dictionaryCode = rootGetters['user/getDictionaryCode'] const clientId = getCurrentClient() const roleId = getCurrentRole() const userId = rootGetters['user/getUserId'] @@ -80,6 +81,7 @@ export default { requestReportMetadata({ id, language, + dictionaryCode, clientId, roleId, userId diff --git a/src/store/modules/ADempiere/dictionary/window/actions.js b/src/store/modules/ADempiere/dictionary/window/actions.js index 96c4afec75..e361d9734b 100644 --- a/src/store/modules/ADempiere/dictionary/window/actions.js +++ b/src/store/modules/ADempiere/dictionary/window/actions.js @@ -98,6 +98,7 @@ export default { id }) { const language = rootGetters['getCurrentLanguage'] + const dictionaryCode = rootGetters['user/getDictionaryCode'] const clientId = getCurrentClient() const roleId = getCurrentRole() const userId = rootGetters['user/getUserId'] @@ -106,6 +107,7 @@ export default { requestWindowMetadata({ id, language, + dictionaryCode, clientId, roleId, userId diff --git a/src/store/modules/ADempiere/formDefinition.js b/src/store/modules/ADempiere/formDefinition.js index 31fc71760b..2f2d33aac6 100644 --- a/src/store/modules/ADempiere/formDefinition.js +++ b/src/store/modules/ADempiere/formDefinition.js @@ -25,7 +25,7 @@ import lang from '@/lang' import { CONTAINER_FORM_PREFIX } from '@/utils/ADempiere/dictionary/form/index.js' // API Request Methods -import { requestForm } from '@/api/ADempiere/dictionary/index.ts' +import { requestForm } from '@/api/ADempiere/dictionary/form' // Utils and Helper Methods import { showMessage } from '@/utils/ADempiere/notification' @@ -89,7 +89,7 @@ const form = { const newForm = { ...formResponse, containerUuid: formResponse.uuid, - containerKey: CONTAINER_FORM_PREFIX + formResponse.id + containerKey: CONTAINER_FORM_PREFIX + formResponse.internal_id } commit('addForm', newForm) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 87c5a70c66..c419210e9e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -858,6 +858,15 @@ const getters = { getSystem: (state) => { return state.systemInfo }, + getDictionaryCode: (state) => { + if (isEmptyValue(state.role)) { + return '' + } + if (isEmptyValue(state.role.client)) { + return '' + } + return state.role.client.dictionary_code + }, getDictionaryVersion: (state) => { return state.dictionary }, From 74997aa204965d206c0e5b82d3fd2250c8f0a7c5 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Mon, 15 Jul 2024 21:37:14 -0400 Subject: [PATCH 3/8] feat: Get menu multitenant. (#2450) --- src/api/ADempiere/dictionary/form.js | 10 ++-------- src/api/ADempiere/dictionary/process.js | 10 ++-------- src/api/ADempiere/dictionary/smart-browser.js | 10 ++-------- src/api/ADempiere/dictionary/window.ts | 2 ++ src/api/ADempiere/security/index.ts | 2 ++ src/router/modules/ADempiere/menu.js | 15 ++++++++------- .../ADempiere/dictionary/browser/actions.js | 9 +-------- .../ADempiere/dictionary/process/actions.js | 11 +---------- .../ADempiere/dictionary/report/actions.js | 11 +---------- .../ADempiere/dictionary/window/actions.js | 11 +---------- src/store/modules/ADempiere/formDefinition.js | 11 ++--------- 11 files changed, 24 insertions(+), 78 deletions(-) diff --git a/src/api/ADempiere/dictionary/form.js b/src/api/ADempiere/dictionary/form.js index bcb33d0861..45596f37a5 100644 --- a/src/api/ADempiere/dictionary/form.js +++ b/src/api/ADempiere/dictionary/form.js @@ -27,20 +27,14 @@ export function requestForm({ id: uuid, // mandatory to open search language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) { return request({ url: `/dictionary/forms/${uuid}`, method: 'get', params: { language, - dictionary_code: dictionaryCode, - client_id: clientId, - role_id: roleId, - user_id: userId + dictionary_code: dictionaryCode } }) } diff --git a/src/api/ADempiere/dictionary/process.js b/src/api/ADempiere/dictionary/process.js index 203fe09f2d..4da9c181ed 100644 --- a/src/api/ADempiere/dictionary/process.js +++ b/src/api/ADempiere/dictionary/process.js @@ -32,20 +32,14 @@ export function requestProcessMetadata({ id: uuid, // mandatory to open search language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) { return request({ url: `/dictionary/processes/${uuid}`, method: 'get', params: { language, - dictionary_code: dictionaryCode, - client_id: clientId, - role_id: roleId, - user_id: userId + dictionary_code: dictionaryCode } }) } diff --git a/src/api/ADempiere/dictionary/smart-browser.js b/src/api/ADempiere/dictionary/smart-browser.js index 994d1f9e91..4bef7f5263 100644 --- a/src/api/ADempiere/dictionary/smart-browser.js +++ b/src/api/ADempiere/dictionary/smart-browser.js @@ -27,20 +27,14 @@ import { request } from '@/utils/ADempiere/request' export function requestBrowserMetadata({ id: uuid, language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) { return request({ url: `/dictionary/browsers/${uuid}`, method: 'get', params: { language, - dictionary_code: dictionaryCode, - client_id: clientId, - role_id: roleId, - user_id: userId + dictionary_code: dictionaryCode } }) } diff --git a/src/api/ADempiere/dictionary/window.ts b/src/api/ADempiere/dictionary/window.ts index f42af00edc..620924c1be 100644 --- a/src/api/ADempiere/dictionary/window.ts +++ b/src/api/ADempiere/dictionary/window.ts @@ -46,12 +46,14 @@ export function requestWindowMetadata({ export function requestTabMetadata({ id: uuid, windowId, + language, dictionaryCode }) { return request({ url: `/dictionary/windows/${windowId}/tabs/${uuid}`, method: 'get', params: { + language, dictionary_code: dictionaryCode } }) diff --git a/src/api/ADempiere/security/index.ts b/src/api/ADempiere/security/index.ts index 6e5520b47c..604f855585 100644 --- a/src/api/ADempiere/security/index.ts +++ b/src/api/ADempiere/security/index.ts @@ -146,6 +146,7 @@ export function requestChangeRole({ */ export function requestMenu({ language, + dictionaryCode, clientId, roleId, userUuid @@ -155,6 +156,7 @@ export function requestMenu({ method: 'get', params: { language, + dictionary_code: dictionaryCode, role_id: roleId, client_id: clientId, user_id: userUuid, diff --git a/src/router/modules/ADempiere/menu.js b/src/router/modules/ADempiere/menu.js index d4abdf473e..d1b18b62bc 100644 --- a/src/router/modules/ADempiere/menu.js +++ b/src/router/modules/ADempiere/menu.js @@ -44,18 +44,19 @@ export function loadMainMenu({ role }) { const language = store.getters['getCurrentLanguage'] - // const { uuid, client } = store.getters['user/getRole'] - const clientId = store.getters['user/getRole'].client.uuid - const roleId = store.getters['user/getRole'].uuid - const userId = store.getters['user/getUserId'] + const dictionaryCode = store.getters['user/getDictionaryCode'] + const { id: roleId, uuid: roleUuid, client } = store.getters['user/getRole'] + const { id: clientId, uuid: clientUuid } = client const organizationId = getCurrentOrganization() + const { uuid: userUuid } = store.getters['user/userInfo'] return new Promise(resolve => { requestMenu({ - roleId, language, - clientId, - userId + dictionaryCode, + clientId: clientUuid, + roleId: roleUuid, + userUuid: userUuid }).then(menuResponse => { const { menus } = menuResponse const asyncRoutesMap = [] diff --git a/src/store/modules/ADempiere/dictionary/browser/actions.js b/src/store/modules/ADempiere/dictionary/browser/actions.js index 023e585ee1..e6cbd1ed31 100644 --- a/src/store/modules/ADempiere/dictionary/browser/actions.js +++ b/src/store/modules/ADempiere/dictionary/browser/actions.js @@ -48,7 +48,6 @@ import { } from '@/utils/ADempiere/dictionary/browser/actionsMenu' import { showMessage, showNotification } from '@/utils/ADempiere/notification.js' import { isLookup } from '@/utils/ADempiere/references' -import { getCurrentClient, getCurrentRole } from '@/utils/ADempiere/auth' import { templateBrowser } from '@/utils/ADempiere/dictionary/browser/templateBrowser.js' export default { @@ -60,17 +59,11 @@ export default { return new Promise(resolve => { const language = rootGetters['getCurrentLanguage'] const dictionaryCode = rootGetters['user/getDictionaryCode'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() - const userId = rootGetters['user/getUserId'] requestBrowserMetadata({ id, language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) .then(browserResponse => { const browser = templateBrowser(browserResponse) diff --git a/src/store/modules/ADempiere/dictionary/process/actions.js b/src/store/modules/ADempiere/dictionary/process/actions.js index 63ece52a05..950da46858 100644 --- a/src/store/modules/ADempiere/dictionary/process/actions.js +++ b/src/store/modules/ADempiere/dictionary/process/actions.js @@ -33,9 +33,6 @@ import { import { clearParameters, runProcess } from '@/utils/ADempiere/dictionary/process/actionsMenu.ts' -import { - getCurrentClient, getCurrentRole -} from '@/utils/ADempiere/auth' export default { addProcessToList({ commit, dispatch }, processResponse) { @@ -65,18 +62,12 @@ export default { }) { const language = rootGetters['getCurrentLanguage'] const dictionaryCode = rootGetters['user/getDictionaryCode'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() - const userId = rootGetters['user/getUserId'] return new Promise((resolve, reject) => { requestProcessMetadata({ id, language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) .then(processResponse => { const { processDefinition } = generateProcess({ diff --git a/src/store/modules/ADempiere/dictionary/report/actions.js b/src/store/modules/ADempiere/dictionary/report/actions.js index c7605f333e..313e616c0d 100644 --- a/src/store/modules/ADempiere/dictionary/report/actions.js +++ b/src/store/modules/ADempiere/dictionary/report/actions.js @@ -42,9 +42,6 @@ import { import { generateProcess as generateReport, isDisplayedField } from '@/utils/ADempiere/dictionary/process.js' import { isSalesTransaction } from '@/utils/ADempiere/contextUtils' import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' -import { - getCurrentClient, getCurrentRole -} from '@/utils/ADempiere/auth' export default { addReportToList({ commit, dispatch }, reportResponse) { @@ -74,17 +71,11 @@ export default { return new Promise((resolve, reject) => { const language = rootGetters['getCurrentLanguage'] const dictionaryCode = rootGetters['user/getDictionaryCode'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() - const userId = rootGetters['user/getUserId'] requestReportMetadata({ id, language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) .then(async reportResponse => { const { uuid } = reportResponse diff --git a/src/store/modules/ADempiere/dictionary/window/actions.js b/src/store/modules/ADempiere/dictionary/window/actions.js index e361d9734b..dedc0d9df3 100644 --- a/src/store/modules/ADempiere/dictionary/window/actions.js +++ b/src/store/modules/ADempiere/dictionary/window/actions.js @@ -52,9 +52,6 @@ import { openBrowserAssociated, openSequenceTab } from '@/utils/ADempiere/dictionary/window/actionsMenu' -import { - getCurrentClient, getCurrentRole -} from '@/utils/ADempiere/auth' import { panelAdvanceQuery } from '@/utils/ADempiere/dictionary/panel.js' import { exportRecordsSelected, @@ -99,18 +96,12 @@ export default { }) { const language = rootGetters['getCurrentLanguage'] const dictionaryCode = rootGetters['user/getDictionaryCode'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() - const userId = rootGetters['user/getUserId'] return new Promise(resolve => { requestWindowMetadata({ id, language, - dictionaryCode, - clientId, - roleId, - userId + dictionaryCode }) .then(async windowResponse => { const window = generateWindow(windowResponse) diff --git a/src/store/modules/ADempiere/formDefinition.js b/src/store/modules/ADempiere/formDefinition.js index 2f2d33aac6..5dcd4a864d 100644 --- a/src/store/modules/ADempiere/formDefinition.js +++ b/src/store/modules/ADempiere/formDefinition.js @@ -30,9 +30,6 @@ import { requestForm } from '@/api/ADempiere/dictionary/form' // Utils and Helper Methods import { showMessage } from '@/utils/ADempiere/notification' import { isEmptyValue } from '@/utils/ADempiere/valueUtils' -import { - getCurrentClient, getCurrentRole -} from '@/utils/ADempiere/auth' const form = { state: { @@ -73,16 +70,12 @@ const form = { }) { return new Promise(resolve => { const language = rootGetters['getCurrentLanguage'] - const clientId = getCurrentClient() - const roleId = getCurrentRole() - const userId = rootGetters['user/getUserId'] + const dictionaryCode = rootGetters['user/getDictionaryCode'] requestForm({ id, language, - clientId, - roleId, - userId + dictionaryCode }) .then(formResponse => { // Panel for save on store From 94f4032dce87e1bead103926dfd6c8f31a08daff Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Wed, 17 Jul 2024 18:10:19 -0400 Subject: [PATCH 4/8] feat: Manage `internal_id` as old `id`. (#2453) --- .../FieldDefinition/FieldAccountingCombination/index.vue | 2 +- .../FieldSearch/BusinessPartnerInfo/businessPartnersList.vue | 2 +- .../FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue | 2 +- .../FieldDefinition/FieldSearch/GeneralInfoSearch/index.vue | 2 +- .../FieldDefinition/FieldSearch/GeneralInfoSearch/panel.vue | 4 ++-- .../FieldDefinition/FieldSearch/InvoiceInfo/index.vue | 2 +- .../FieldSearch/Order/businessPartnersList.vue | 2 +- .../ADempiere/FieldDefinition/FieldSearch/Order/index.vue | 2 +- .../FieldSearch/Payment/businessPartnersList.vue | 2 +- .../ADempiere/FieldDefinition/FieldSearch/Payment/index.vue | 2 +- .../FieldDefinition/FieldSearch/ProductInfo/index.vue | 2 +- .../ADempiere/FieldDefinition/FieldSearch/index.vue | 2 +- .../ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js | 2 +- .../ADempiere/FieldDefinition/FieldSelect/index.vue | 4 ++-- .../ADempiere/FieldDefinition/FieldSelect/mixinFieldSelect.js | 4 ++-- .../ADempiere/FieldDefinition/FieldWarehouseLocator/index.vue | 2 +- src/components/ADempiere/FieldDefinition/mixin/mixinField.js | 4 ++-- .../ADempiere/FieldDefinition/useFieldDefinition.js | 4 ++-- src/views/ADempiere/Browser/index.vue | 3 ++- src/views/ADempiere/Form/index.vue | 3 ++- src/views/ADempiere/Process/index.vue | 3 ++- src/views/ADempiere/Report/index.vue | 3 ++- src/views/ADempiere/ReportViewer/index.vue | 3 ++- 23 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/index.vue b/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/index.vue index bcee464349..2022f04df0 100644 --- a/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldAccountingCombination/index.vue @@ -151,7 +151,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/businessPartnersList.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/businessPartnersList.vue index 6223ef5b5b..5725e32571 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/businessPartnersList.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/businessPartnersList.vue @@ -440,7 +440,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: this.searchTableName, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, filters, pageNumber, pageSize diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue index 8a856e7445..2d974d5068 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/BusinessPartnerInfo/index.vue @@ -163,7 +163,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/index.vue index 39281f2bea..891a6d9e5b 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/index.vue @@ -139,7 +139,7 @@ export default { tableName: this.searchTableName, columnName: this.metadata.column_name, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/panel.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/panel.vue index a8daaed52c..8ed4e71942 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/panel.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch/panel.vue @@ -386,7 +386,7 @@ export default { const fieldsListTable = this.storedColumnsListTable if (isEmptyValue(fieldsListTable)) { this.containerManager.getSearchDefinition({ - id: this.metadata.id + id: this.metadata.internal_id }) .finally(() => { this.isLoadingFields = false @@ -424,7 +424,7 @@ export default { parentUuid: this.metadata.parentUuid, tableName: this.searchTableName, columnName: this.metadata.columnName, - id: this.metadata.id, + id: this.metadata.internal_id, contextColumnNames: this.metadata.reference.context_column_names, filters: values, pageNumber, diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue index 7a2c12eed1..8785424670 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue @@ -251,7 +251,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/Order/businessPartnersList.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/Order/businessPartnersList.vue index 343b9d0d68..bec208f413 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/Order/businessPartnersList.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/Order/businessPartnersList.vue @@ -508,7 +508,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: this.searchTableName, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, filters, pageNumber, pageSize diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/Order/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/Order/index.vue index 55c1120d80..4076134ebc 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/Order/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/Order/index.vue @@ -251,7 +251,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/businessPartnersList.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/businessPartnersList.vue index e8e748b8ee..187be07f3c 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/businessPartnersList.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/businessPartnersList.vue @@ -508,7 +508,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: this.searchTableName, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, filters, pageNumber, pageSize diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/index.vue index 466bc3e360..d2f844bddc 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/Payment/index.vue @@ -251,7 +251,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/index.vue index 3d47eec906..a2dd58791b 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/index.vue @@ -187,7 +187,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, tableName: TABLE_NAME, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue index 575314fcba..6248f33011 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue @@ -142,7 +142,7 @@ export default { // load definition this.containerManager.getSearchDefinition({ uuid: this.metadata.uuid, - id: this.metadata.id + id: this.metadata.internal_id }) } } diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js b/src/components/ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js index d31829271a..133f9e7b04 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/mixinFieldSearch.js @@ -109,7 +109,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, contextColumnNamesByDefaultValue: this.metadata.context_column_names, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, // tableName: this.searchTableName, columnName: this.metadata.column_name, diff --git a/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue b/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue index 84a7340f03..c97f62d0c8 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSelect/index.vue @@ -105,7 +105,7 @@ export default { containerUuid: this.metadata.containerUuid, contextColumnNames: this.metadata.contextColumnNames, uuid: this.metadata.uuid, - id: this.metadata.id + id: this.metadata.internal_id }) ) }, @@ -374,7 +374,7 @@ export default { containerUuid: this.metadata.containerUuid, contextColumnNames: this.metadata.reference.context_column_names, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, // tableName: this.metadata.referenceTableName, columnName: this.metadata.column_name, diff --git a/src/components/ADempiere/FieldDefinition/FieldSelect/mixinFieldSelect.js b/src/components/ADempiere/FieldDefinition/FieldSelect/mixinFieldSelect.js index 4005d0c77d..1460ed4e2f 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSelect/mixinFieldSelect.js +++ b/src/components/ADempiere/FieldDefinition/FieldSelect/mixinFieldSelect.js @@ -69,7 +69,7 @@ export default { containerUuid: this.metadata.containerUuid, contextColumnNames: this.metadata.reference.context_column_names, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, // tableName: this.metadata.referenceTableName, columnName: this.metadata.columnName @@ -90,7 +90,7 @@ export default { contextColumnNames: this.metadata.reference.context_column_names, contextColumnNamesByDefaultValue: this.metadata.context_column_names, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, // tableName: this.metadata.referenceTableName, columnName: this.metadata.columnName, diff --git a/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/index.vue b/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/index.vue index 765f59950b..8c658ff706 100644 --- a/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldWarehouseLocator/index.vue @@ -158,7 +158,7 @@ export default { contextAttributesList, warehouseId: this.warehouseId, uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, searchValue, pageNumber: 1, pageSize: RECORD_ROWS_BY_LIST diff --git a/src/components/ADempiere/FieldDefinition/mixin/mixinField.js b/src/components/ADempiere/FieldDefinition/mixin/mixinField.js index 3be19b4212..7559deedfb 100644 --- a/src/components/ADempiere/FieldDefinition/mixin/mixinField.js +++ b/src/components/ADempiere/FieldDefinition/mixin/mixinField.js @@ -99,7 +99,7 @@ export default { contextColumnNames: this.metadata.contextColumnNames, // uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, defaultValue: this.metadata.default_value, value: this.value }) @@ -252,7 +252,7 @@ export default { rowUid: this.metadata.rowUid, // uuid: this.metadata.uuid, - id: this.metadata.id, + id: this.metadata.internal_id, columnName: this.metadata.column_name, value: this.value }) diff --git a/src/components/ADempiere/FieldDefinition/useFieldDefinition.js b/src/components/ADempiere/FieldDefinition/useFieldDefinition.js index ed3aced3ec..8815e1c5a2 100644 --- a/src/components/ADempiere/FieldDefinition/useFieldDefinition.js +++ b/src/components/ADempiere/FieldDefinition/useFieldDefinition.js @@ -151,7 +151,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) contextColumnNames: fieldMetadata.contextColumnNames, // uuid: fieldMetadata.uuid, - id: fieldMetadata.id, + id: fieldMetadata.internal_id, value: value.value }) }) @@ -194,7 +194,7 @@ export default function useFieldDefinition({ fieldMetadata, containerManager }) rowUid: fieldMetadata.rowUid, // uuid: fieldMetadata.uuid, - id: fieldMetadata.id, + id: fieldMetadata.internal_id, columnName: fieldMetadata.column_name, value: value.value }) diff --git a/src/views/ADempiere/Browser/index.vue b/src/views/ADempiere/Browser/index.vue index a95f1b5d61..6b39c7d754 100644 --- a/src/views/ADempiere/Browser/index.vue +++ b/src/views/ADempiere/Browser/index.vue @@ -277,7 +277,8 @@ export default defineComponent({ } store.dispatch('getBrowserDefinitionFromServer', { - id: browserId, + // id: browserId, + id: browserUuid, parentUuid, containerUuid }) diff --git a/src/views/ADempiere/Form/index.vue b/src/views/ADempiere/Form/index.vue index 88e8ba1620..e14bfa2d62 100644 --- a/src/views/ADempiere/Form/index.vue +++ b/src/views/ADempiere/Form/index.vue @@ -157,7 +157,8 @@ export default defineComponent({ return } store.dispatch('getFormFromServer', { - id: formId, + // id: formId, + id: formUuid, routeToDelete: currentRoute }) .then(responseForm => { diff --git a/src/views/ADempiere/Process/index.vue b/src/views/ADempiere/Process/index.vue index 6fc3ecf8bd..4c0dfed1b7 100644 --- a/src/views/ADempiere/Process/index.vue +++ b/src/views/ADempiere/Process/index.vue @@ -146,7 +146,8 @@ export default defineComponent({ // } store.dispatch('getProcessDefinitionFromServer', { - id: processId + // id: processId + id: processUuid }) .then(processResponse => { processMetadata.value = processResponse diff --git a/src/views/ADempiere/Report/index.vue b/src/views/ADempiere/Report/index.vue index 8aa41c54a7..5ca0d1dd64 100644 --- a/src/views/ADempiere/Report/index.vue +++ b/src/views/ADempiere/Report/index.vue @@ -188,7 +188,8 @@ export default defineComponent({ // } store.dispatch('getReportDefinitionFromServer', { - id: reportId + // id: reportId + id: reportUuid }) .then(reportResponse => { reportMetadata.value = reportResponse diff --git a/src/views/ADempiere/ReportViewer/index.vue b/src/views/ADempiere/ReportViewer/index.vue index 4abbfbd014..599d11f7be 100644 --- a/src/views/ADempiere/ReportViewer/index.vue +++ b/src/views/ADempiere/ReportViewer/index.vue @@ -196,7 +196,8 @@ export default defineComponent({ } store.dispatch('getReportDefinitionFromServer', { - id: reportId + // id: reportId + id: reportUuid }).then(() => { getCachedReport() }) From 7076751a4ff03a8a315fc0683844b501ecd0d6d5 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Fri, 19 Jul 2024 08:44:04 -0400 Subject: [PATCH 5/8] fix: Run business process. (#2457) * fix: Run business process. * Remove workflow changes --- .../runBusinessProcess.ts | 0 src/api/ADempiere/process.js | 78 ------------------- .../Process/ExportDictionaryDefinition.vue | 2 +- src/store/modules/ADempiere/processManager.js | 4 +- src/store/modules/ADempiere/system.js | 2 +- src/views/ADempiere/Browser/index.vue | 2 +- 6 files changed, 5 insertions(+), 83 deletions(-) rename src/api/ADempiere/{businessData => business-data}/runBusinessProcess.ts (100%) delete mode 100644 src/api/ADempiere/process.js diff --git a/src/api/ADempiere/businessData/runBusinessProcess.ts b/src/api/ADempiere/business-data/runBusinessProcess.ts similarity index 100% rename from src/api/ADempiere/businessData/runBusinessProcess.ts rename to src/api/ADempiere/business-data/runBusinessProcess.ts diff --git a/src/api/ADempiere/process.js b/src/api/ADempiere/process.js deleted file mode 100644 index 9dbc52c7fe..0000000000 --- a/src/api/ADempiere/process.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution - * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com - * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Get Instance for connection -import { request } from '@/utils/ADempiere/request' - -/** - * Request a process - * This function allows follow structure: - * @param {string} id, identifier from process to run - * @param {string} uuid, uuid from process to run - * @param {string} tableName, table name of tab, used only window - * @param {number} recordId, record identifier, used only window - * @param {string} recordUuid, record universal unique identifier, used only window - * @param {array} parametersList, parameters from process [{ columnName, value }] - * @param {array} selectionsList, selection records, used only browser - [{ - selectionId, - values: [{ columnName, value }] - }] - * @param {number} tableSelectedId, used only browser // TODO: Add support on adempiere-vue - */ -export function requestRunProcess({ - id, - uuid, - parametersList = [], - // window - tableName, - recordId, - recordUuid, - // browse - browserId, - selectionsList = [] -}) { - parametersList = parametersList.map(parameter => { - return { - key: parameter.columnName, - value: parameter.value - } - }) - - return request({ - url: '/common/api/process', - method: 'post', - data: { - id, - uuid, - parameters: parametersList, - // - table_name: tableName, - record_id: recordId, - record_uuid: recordUuid, - // - browser_id: browserId, - selections: selectionsList - } - }) - .then(processRunResponse => { - const { convertProcessLog } = require('@/utils/ADempiere/apiConverts/process.js') - - return convertProcessLog(processRunResponse) - }) -} diff --git a/src/components/ADempiere/Process/ExportDictionaryDefinition.vue b/src/components/ADempiere/Process/ExportDictionaryDefinition.vue index 1bd9cd0785..33167d24e8 100644 --- a/src/components/ADempiere/Process/ExportDictionaryDefinition.vue +++ b/src/components/ADempiere/Process/ExportDictionaryDefinition.vue @@ -160,7 +160,7 @@ import PanelFooter from '@/components/ADempiere/PanelFooter/index.vue' // API Request Methods import { requestRunBusinessProcess -} from '@/api/ADempiere/businessData/runBusinessProcess.ts' +} from '@/api/ADempiere/business-data/runBusinessProcess.ts' // Utils and Helper Methods import { isEmptyValue } from '@/utils/ADempiere/valueUtils' diff --git a/src/store/modules/ADempiere/processManager.js b/src/store/modules/ADempiere/processManager.js index bf6f45930f..a5d8d058f0 100644 --- a/src/store/modules/ADempiere/processManager.js +++ b/src/store/modules/ADempiere/processManager.js @@ -26,7 +26,7 @@ import { requestRunBusinessProcess, requestRunBusinessProcessAsBrowser, requestRunBusinessProcessAsWindow -} from '@/api/ADempiere/businessData/runBusinessProcess.ts' +} from '@/api/ADempiere/business-data/runBusinessProcess.ts' // Constants import { RECORD_ID } from '@/utils/ADempiere/constants/systemColumns' @@ -126,7 +126,7 @@ const processManager = { }, () => {}) requestRunBusinessProcess({ - id: processDefinition.id, + id: processDefinition.internal_id, parameters }) .then(runProcessRepsonse => { diff --git a/src/store/modules/ADempiere/system.js b/src/store/modules/ADempiere/system.js index fd997d3bb8..31141906c4 100644 --- a/src/store/modules/ADempiere/system.js +++ b/src/store/modules/ADempiere/system.js @@ -20,7 +20,7 @@ import { requestLanguagesList } from '@/api/ADempiere/system-core.js' import { requestRunBusinessProcess as runResetCache -} from '@/api/ADempiere/businessData/runBusinessProcess.ts' +} from '@/api/ADempiere/business-data/runBusinessProcess.ts' // Constants import { RESET_CACHE_PROCESS_ID } from '@/utils/ADempiere/constants/process' diff --git a/src/views/ADempiere/Browser/index.vue b/src/views/ADempiere/Browser/index.vue index 6b39c7d754..2bc01b199d 100644 --- a/src/views/ADempiere/Browser/index.vue +++ b/src/views/ADempiere/Browser/index.vue @@ -278,7 +278,7 @@ export default defineComponent({ store.dispatch('getBrowserDefinitionFromServer', { // id: browserId, - id: browserUuid, + id: browserUuid.value, parentUuid, containerUuid }) From 3e2788626c6e14895b1f18d4a9c6fbda9c7bce71 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Thu, 25 Jul 2024 01:27:53 -0400 Subject: [PATCH 6/8] fix: Load menu without child nodes. (#2491) * fix: Load menu without child nodes. * fix imports --- src/router/modules/ADempiere/menu.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/router/modules/ADempiere/menu.js b/src/router/modules/ADempiere/menu.js index d1b18b62bc..1527bd8394 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, From 56729bac6bc579fe3cd52745c9a6a6680dc1ca31 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Tue, 30 Jul 2024 18:19:34 -0400 Subject: [PATCH 7/8] feat: Enable `Export Dictionary Definition` form only `System` role. (#2537) * feat: Enable `Export Dictionary Definition` form only `System` role. * fix: Process Identifier. --- .../Process/ExportDictionaryDefinition.vue | 23 +++++++++++-------- src/router/modules/ADempiere/staticRoutes.js | 7 ++++++ .../process/exportDictionaryDefinition.ts | 19 +++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/utils/ADempiere/dictionary/process/exportDictionaryDefinition.ts diff --git a/src/components/ADempiere/Process/ExportDictionaryDefinition.vue b/src/components/ADempiere/Process/ExportDictionaryDefinition.vue index 33167d24e8..3cf0c4c986 100644 --- a/src/components/ADempiere/Process/ExportDictionaryDefinition.vue +++ b/src/components/ADempiere/Process/ExportDictionaryDefinition.vue @@ -48,6 +48,7 @@ + + + + + + false } + requestRunBusinessProcess({ - id: 54692, + id: EXPORT_DICTIONARY_DEFINITION_PROCESS_ID, parameters: { ECA56_ExportMenu: isMenu.value, ECA56_ExportForms: isForm.value, @@ -279,15 +291,6 @@ export default defineComponent({