From bcf40b8cf98a0269b7fb3bc4b59b46a9200944fa Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Fri, 3 Nov 2023 07:57:02 -0400 Subject: [PATCH] fix: Run Document Action. --- src/api/ADempiere/workflow.js | 16 ++++------------ .../FieldOptions/DocumentStatus/index.vue | 3 ++- .../convenienceButtons/documentAction.vue | 5 ++++- src/store/modules/ADempiere/documentManager.js | 14 ++++++++------ src/utils/ADempiere/dictionary/window.js | 9 +++++++-- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/api/ADempiere/workflow.js b/src/api/ADempiere/workflow.js index 3e5eb9430e3..30506bed5f4 100644 --- a/src/api/ADempiere/workflow.js +++ b/src/api/ADempiere/workflow.js @@ -145,25 +145,17 @@ export function getWorkflow({ /** * Request Document Status List * @param {string} tableName - * @param {number} id - * @param {string} uuid + * @param {number} recordId record identifier * @param {string} docAction */ export function requestRunDocumentAction({ tableName, - id, - uuid, + recordId, docAction }) { return request({ - url: '/workflow/run-document-action', - method: 'get', - params: { - table_name: tableName, - id, - uuid, - document_action: docAction - } + url: `/workflow/workflows/run-action/${tableName}/${recordId}/${docAction}`, + method: 'post' }) } diff --git a/src/components/ADempiere/FieldDefinition/FieldOptions/DocumentStatus/index.vue b/src/components/ADempiere/FieldDefinition/FieldOptions/DocumentStatus/index.vue index 9cc09757423..d45fd2a9c27 100644 --- a/src/components/ADempiere/FieldDefinition/FieldOptions/DocumentStatus/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldOptions/DocumentStatus/index.vue @@ -269,8 +269,9 @@ export default defineComponent({ store.commit('setShowFieldOption', false) - store.dispatch('runDocumentAction', { + store.dispatch('runDocumentActionOnserver', { tableName, + recordId: recordId.value, recordUuid: recordUuid.value, docAction: docActionValue, containerUuid diff --git a/src/components/ADempiere/TabManager/convenienceButtons/documentAction.vue b/src/components/ADempiere/TabManager/convenienceButtons/documentAction.vue index 895fffde2a0..574a98f7d7d 100644 --- a/src/components/ADempiere/TabManager/convenienceButtons/documentAction.vue +++ b/src/components/ADempiere/TabManager/convenienceButtons/documentAction.vue @@ -345,6 +345,8 @@ export default defineComponent({ refreshRecord.refreshRecord({ parentUuid: props.parentUuid, containerUuid, + tabId: props.tabAttributes.id, + recordId: recordId.value, isRefreshChilds: true }) @@ -361,8 +363,9 @@ export default defineComponent({ function sendAction() { isVisibleDocAction.value = false isLoadingActions.value = true - store.dispatch('runDocumentAction', { + store.dispatch('runDocumentActionOnserver', { tableName: props.tabAttributes.tableName, + recordId: recordId.value, recordUuid: recordUuid.value, containerUuid, docAction: selectDocActions.value, diff --git a/src/store/modules/ADempiere/documentManager.js b/src/store/modules/ADempiere/documentManager.js index 24bdfd69bec..a47b5a8b63f 100644 --- a/src/store/modules/ADempiere/documentManager.js +++ b/src/store/modules/ADempiere/documentManager.js @@ -139,19 +139,21 @@ const documentManager = { }) }, - runDocumentAction({ commit, dispatch }, { - recordId, + /** + * TODO: Refres document status and document actions finally process + */ + runDocumentActionOnserver({ commit, dispatch }, { tableName, - docAction, + recordId, recordUuid, + docAction, description }) { return new Promise(resolve => { requestRunDocumentAction({ tableName, - docAction, - id: recordId, - uuid: recordUuid + recordId, + docAction }) .then(response => { let text diff --git a/src/utils/ADempiere/dictionary/window.js b/src/utils/ADempiere/dictionary/window.js index 5feffa0cd62..57add813b08 100644 --- a/src/utils/ADempiere/dictionary/window.js +++ b/src/utils/ADempiere/dictionary/window.js @@ -1126,6 +1126,13 @@ export const refreshRecord = { if (isEmptyValue(recordUuid)) { recordUuid = store.getters.getUuidOfContainer(containerUuid) } + const tabDefinition = store.getters.getStoredTab(parentUuid, containerUuid) + if (isEmptyValue(recordId)) { + recordId = store.getters.getIdOfContainer({ + containerUuid: containerUuid, + tableName: tabDefinition.tableName + }) + } store.dispatch('reloadTableData', { isLoaded: false, @@ -1153,8 +1160,6 @@ export const refreshRecord = { } }) - const tabDefinition = store.getters.getStoredTab(parentUuid, containerUuid) - // update fields values store.dispatch('updateValuesOfContainer', { parentUuid,