Skip to content

Commit

Permalink
fix: Record is processed read only buttons. (adempiere#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Jan 9, 2023
1 parent 55f6118 commit 045f979
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
2 changes: 2 additions & 0 deletions src/utils/ADempiere/constants/systemColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down
61 changes: 32 additions & 29 deletions src/utils/ADempiere/dictionary/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 })) {
Expand All @@ -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
}

Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 045f979

Please sign in to comment.