Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Is read only record with different client id. #676

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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