From 045f979e76e4ab75e31206e9f836ebb98de84758 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Mon, 9 Jan 2023 12:28:05 -0400 Subject: [PATCH] fix: Record is processed read only buttons. (#694) --- .../ADempiere/constants/systemColumns.js | 2 + src/utils/ADempiere/dictionary/window.js | 61 ++++++++++--------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/utils/ADempiere/constants/systemColumns.js b/src/utils/ADempiere/constants/systemColumns.js index 760fdbfb034..dfdde2a17f8 100644 --- a/src/utils/ADempiere/constants/systemColumns.js +++ b/src/utils/ADempiere/constants/systemColumns.js @@ -40,6 +40,8 @@ export const IS_SO_TRX = 'IsSOTrx' export const DOCUMENT_STATUS = 'DocStatus' +export const DOCUMENT_ACTION = 'DocAction' + /** * Is sales transaction (IsSOTrx, IsSalesTransaction) */ diff --git a/src/utils/ADempiere/dictionary/window.js b/src/utils/ADempiere/dictionary/window.js index eaffa687354..1ac592df531 100644 --- a/src/utils/ADempiere/dictionary/window.js +++ b/src/utils/ADempiere/dictionary/window.js @@ -25,7 +25,7 @@ import { IDENTIFIER_COLUMN_SUFFIX } from '@/utils/ADempiere/dictionaryUtils' import { - ACTIVE, CLIENT, PROCESSING, PROCESSED, UUID, + ACTIVE, CLIENT, DOCUMENT_ACTION, PROCESSING, PROCESSED, UUID, READ_ONLY_FORM_COLUMNS } from '@/utils/ADempiere/constants/systemColumns' import { ROW_ATTRIBUTES } from '@/utils/ADempiere/tableUtils' @@ -1185,7 +1185,7 @@ export const containerManager = { isDisplayedColumn, isReadOnlyField(field) { - const { parentUuid, containerUuid } = field + const { parentUuid, containerUuid, columnName } = field // if tab is read only, all fields are read only if (isReadOnlyTab({ parentUuid, containerUuid })) { @@ -1195,7 +1195,7 @@ export const containerManager = { const { isParentTab, linkColumnName, parentColumnName } = store.getters.getStoredTab(parentUuid, containerUuid) // fill value with context - if (linkColumnName === field.columnName || parentColumnName === field.columnName) { + if (field.isParent || linkColumnName === columnName || parentColumnName === columnName) { return true } @@ -1223,49 +1223,52 @@ export const containerManager = { const recordUuid = store.getters.getUuidOfContainer(containerUuid) // edit mode is diferent to create new const isWithRecord = !isEmptyValue(recordUuid) && recordUuid !== 'create-new' - if (!isWithRecord) { - if (field.displayType === BUTTON.id) { - return true - } - } else { + if (isWithRecord) { // not updateable and record saved if (!field.isUpdateable) { return true } // record is inactive isReadOnlyFromForm - if (field.columnName !== ACTIVE) { + if (columnName !== ACTIVE) { // is active value of record const isActiveRecord = store.getters.getValueOfField({ parentUuid, containerUuid, columnName: ACTIVE }) - if (!isActiveRecord) { + if (!convertStringToBoolean(isActiveRecord)) { return true } } + // Button to process document + if (columnName === DOCUMENT_ACTION) { + return false + } - if (field.displayType !== BUTTON.id) { - // is processed value of record - const isProcessed = store.getters.getValueOfField({ - parentUuid, - containerUuid, - columnName: PROCESSED - }) - if (convertStringToBoolean(isProcessed)) { - return true - } + // is processed value of record + const isProcessedRecord = store.getters.getValueOfField({ + parentUuid, + containerUuid, + columnName: PROCESSED + }) + if (convertStringToBoolean(isProcessedRecord)) { + return true + } - // is processing value of record - const isProcessing = store.getters.getValueOfField({ - parentUuid, - containerUuid, - columnName: PROCESSING - }) - if (convertStringToBoolean(isProcessing)) { - return true - } + // is processing value of record + const isProcessingRecord = store.getters.getValueOfField({ + parentUuid, + containerUuid, + columnName: PROCESSING + }) + if (convertStringToBoolean(isProcessingRecord)) { + return true + } + } else { + // button not invoke (browser/process/report/workflow) without record + if (field.displayType === BUTTON.id) { + return true } }