Skip to content

Commit

Permalink
fix: Is read only record with different client id. (#676)
Browse files Browse the repository at this point in the history
Co-authored-by: EdwinBetanc0urt <[email protected]>
  • Loading branch information
EdwinBetanc0urt and EdwinBetanc0urt authored Mar 17, 2021
1 parent 8371350 commit 1c928e2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
28 changes: 21 additions & 7 deletions src/components/ADempiere/Field/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ export default {
}
return this.field.isMandatory || this.field.isMandatoryFromLogic
},
isPanelWindow() {
return this.field.panelType === 'window'
},
preferenceClientId() {
if (this.isPanelWindow) {
return this.$store.getters.getPreferenceClientId
}
return undefined
},
/**
* Idicate if field is read only
* TODO: Create common method to evaluate isReadOnly
Expand All @@ -228,7 +237,15 @@ export default {
const isUpdateableAllFields = this.field.isReadOnly || this.field.isReadOnlyFromLogic
if (this.field.panelType === 'window') {
if (this.isPanelWindow) {
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new
let isWithRecord = this.field.recordUuid !== 'create-new'
// evaluate context
if ((this.preferenceClientId !== this.metadataField.clientId) && isWithRecord) {
return true
}
if (isLogColumns) {
return true
}
Expand All @@ -240,9 +257,6 @@ export default {
return true
}
// TODO: Evaluate record uuid without route.action
// edit mode is diferent to create new
let isWithRecord = this.field.recordUuid !== 'create-new'
if (this.inTable) {
isWithRecord = !this.isEmptyValue(this.field.recordUuid)
}
Expand Down Expand Up @@ -315,7 +329,7 @@ export default {
return newSizes
}
if (this.field.panelType === 'window') {
if (this.isPanelWindow) {
// TODO: Add FieldYesNo and name.length > 12 || 14
if (this.field.componentPath === 'FieldTextLong') {
return sizeField
Expand Down Expand Up @@ -353,15 +367,15 @@ export default {
return this.$store.getters.getOrders
},
isDocuemntStatus() {
if (this.field.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
return true
}
}
return false
},
isContextInfo() {
if (this.field.panelType !== 'window') {
if (!this.isPanelWindow) {
return false
}
return Boolean(this.field.contextInfo && this.field.contextInfo.isActive) ||
Expand Down
20 changes: 18 additions & 2 deletions src/components/ADempiere/Panel/mainPanelMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,38 @@ export default {
recordUuid: this.uuidRecord,
optionCRUD: this.optionCRUD,
isShowedRecordNavigation: this.isShowedRecordNavigation,
clientId: this.getContainerClientId,
isProcessingContext: this.getContainerProcessing,
isProcessedContext: this.getContainerProcessed
}
},
getContainerProcessing() {
if (this.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
return this.$store.getters.getContainerProcessing(this.parentUuid)
}
return false
},
getContainerProcessed() {
if (this.panelType === 'window' && !this.isAdvancedQuery) {
if (this.isPanelWindow && !this.isAdvancedQuery) {
return this.$store.getters.getContainerProcessed(this.parentUuid)
}
return false
},
getContainerClientId() {
let clientId = null
if (this.isPanelWindow && !this.isAdvancedQuery) {
// client id from current record
clientId = this.$store.getters.getValueOfField({
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
columnName: 'AD_Client_ID'
})
if (!this.isEmptyValue(clientId)) {
return parseInt(clientId, 10)
}
}
return clientId
},
getterPanel() {
return this.$store.getters.getPanel(this.containerUuid)
},
Expand Down

0 comments on commit 1c928e2

Please sign in to comment.