Skip to content

Commit

Permalink
fix: Run Document Action.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Nov 3, 2023
1 parent cb724af commit bcf40b8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
16 changes: 4 additions & 12 deletions src/api/ADempiere/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ export default defineComponent({
refreshRecord.refreshRecord({
parentUuid: props.parentUuid,
containerUuid,
tabId: props.tabAttributes.id,
recordId: recordId.value,
isRefreshChilds: true
})

Expand All @@ -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,
Expand Down
14 changes: 8 additions & 6 deletions src/store/modules/ADempiere/documentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/utils/ADempiere/dictionary/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1153,8 +1160,6 @@ export const refreshRecord = {
}
})

const tabDefinition = store.getters.getStoredTab(parentUuid, containerUuid)

// update fields values
store.dispatch('updateValuesOfContainer', {
parentUuid,
Expand Down

0 comments on commit bcf40b8

Please sign in to comment.