diff --git a/src/components/ADempiere/Field/FieldSelect.vue b/src/components/ADempiere/Field/FieldSelect.vue index 13390e82..24b9bdab 100644 --- a/src/components/ADempiere/Field/FieldSelect.vue +++ b/src/components/ADempiere/Field/FieldSelect.vue @@ -138,8 +138,11 @@ export default { if (!this.metadata.inTable) { if (this.metadata.displayed) { if (!this.options.some(option => option.key === value)) { + this.options.push({ + key: value, + label: this.findLabel(value) + }) this.value = value - this.getDataLookupItem() } } this.value = value diff --git a/src/store/modules/ADempiere/calloutControl.js b/src/store/modules/ADempiere/calloutControl.js index 23fc526f..45ba9308 100644 --- a/src/store/modules/ADempiere/calloutControl.js +++ b/src/store/modules/ADempiere/calloutControl.js @@ -61,7 +61,8 @@ const callOutControl = { newValues, isSendToServer: false, withOutColumnNames, - isSendCallout: false + isSendCallout: false, + isChangeFromCallout: true }) } }) diff --git a/src/store/modules/ADempiere/panel.js b/src/store/modules/ADempiere/panel.js index 55b89b2b..965e67a9 100644 --- a/src/store/modules/ADempiere/panel.js +++ b/src/store/modules/ADempiere/panel.js @@ -362,7 +362,8 @@ const panel = { isSendCallout = true, isAdvancedQuery = false, isPrivateAccess = false, - fieldList = [] + fieldList = [], + isChangeFromCallout = false }) { if (!fieldList.length) { fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery) @@ -377,6 +378,46 @@ const panel = { if (!newValues.hasOwnProperty(actionField.columnName)) { return } + + if (isChangeFromCallout && actionField.componentPath === 'FieldSelect' && !newValues.hasOwnProperty(`DisplayColumn_${actionField.columnName}`)) { + const lookup = getters.getLookupItem({ + parentUuid: parentUuid, + containerUuid: containerUuid, + directQuery: actionField.reference.directQuery, + tableName: actionField.reference.tableName, + value: newValues[actionField.columnName] + }) + + if (isEmptyValue(lookup)) { + dispatch('getLookupItemFromServer', { + parentUuid: parentUuid, + containerUuid: containerUuid, + tableName: actionField.reference.tableName, + directQuery: actionField.reference.parsedDirectQuery, + value: newValues[actionField.columnName] + }) + .then(response => { + dispatch('notifyFieldChange', { + isSendToServer, + isSendCallout, + isAdvancedQuery, + panelType, + parentUuid, + containerUuid, + columnName: actionField.columnName, + displayColumn: response.label, + newValue: newValues[actionField.columnName], + valueTo: newValues[`${actionField.columnName}_To`], + fieldList, + field: actionField, + withOutColumnNames, + isChangedOldValue: true // defines if set oldValue with newValue instead of current value + }) + }) + } else { + newValues[`DisplayColumn_${actionField.columnName}`] = lookup.label + } + } dispatch('notifyFieldChange', { isSendToServer, isSendCallout,