Skip to content

Commit

Permalink
fix: Infinity loop on country field of location form. (adempiere#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Mar 6, 2023
1 parent 45b1eeb commit dd90079
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/store/modules/ADempiere/defaultValueManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,9 @@ const defaultValueManager = {
}

// do not use the convertArrayKeyValueToObject method to avoid losing a key with an empty value
// TODO: Response from server same name key of value
if (valueResponse.attributes.length === 1) {
// number values (Line for example)
values.KeyColumn = valueResponse.attributes.at(0).value
values.DisplayColumn = undefined
} else {
valueResponse.attributes.forEach(attribute => {
const { key: column, value: attributeValue } = attribute
Expand All @@ -172,7 +171,8 @@ const defaultValueManager = {
contextAttributesList,
id,
displayedValue,
value,
// set value of server to parsed if is number as string "101" -> 101
value: valueOfServer,
uuid: values.UUID
})

Expand Down
38 changes: 21 additions & 17 deletions src/store/modules/ADempiere/lookupManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import Vue from 'vue'

import lang from '@/lang'

// API Request Methods
Expand Down Expand Up @@ -335,24 +336,27 @@ const lookupManager = {
})

// get of stored default value
if (isEmptyValue(optionsList)) {
const contextAttributesListByDefaultValue = getContextAttributes({
parentUuid,
containerUuid,
contextColumnNames: contextColumnNamesByDefaultValue,
isBooleanToString: true
})
const option = rootGetters.getStoredDefaultValue({
parentUuid,
containerUuid,
contextColumnNames: contextColumnNamesByDefaultValue,
contextAttributesList: contextAttributesListByDefaultValue,
uuid,
value
})
const contextAttributesListByDefaultValue = getContextAttributes({
parentUuid,
containerUuid,
contextColumnNames: contextColumnNamesByDefaultValue,
isBooleanToString: true
})
const option = rootGetters.getStoredDefaultValue({
parentUuid,
containerUuid,
contextColumnNames: contextColumnNamesByDefaultValue,
contextAttributesList: contextAttributesListByDefaultValue,
uuid,
value
})

// add a item option
if (!isEmptyValue(option)) {
// add a item option
if (!isEmptyValue(option)) {
const isExists = optionsList.some(optionItem => {
return optionItem.value === option.value
})
if (!isExists) {
optionsList.push(option)
}
}
Expand Down

0 comments on commit dd90079

Please sign in to comment.