Skip to content

Commit

Permalink
fix: Currency Rate Currency clean with default value. (adempiere#1581
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Nov 4, 2023
1 parent eed89d6 commit e99da64
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/components/ADempiere/PanelDefinition/StandardPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ export default defineComponent({
})
const recordUuid = computed(() => {
// TODO: Change query name 'action'
const { action } = root.$route.query
return action
return store.getters.getUuidOfContainer(props.containerUuid)
})
const shadowGroup = computed(() => {
Expand Down
17 changes: 11 additions & 6 deletions src/store/modules/ADempiere/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const persistence = {
return true
}
// prevent `PO.set_Value: Column not updateable`
if (!isEmptyValue(recordUuid) && !field.isUpdateable) {
if (!isEmptyValue(recordUuid) && recordUuid !== 'create-new' && !field.isUpdateable) {
return false
}
if (LOG_COLUMNS_NAME_LIST.includes(columnName)) {
Expand All @@ -275,7 +275,7 @@ const persistence = {
})

if (!isEmptyValue(attributesList)) {
if (!isEmptyValue(recordUuid)) {
if (!isEmptyValue(recordUuid) && recordUuid !== 'create-new') {
// Update existing entity
if (currentTab.keyColumns.length > 1) {
reccordId = 0
Expand Down Expand Up @@ -463,7 +463,11 @@ const persistence = {
const changes = state.persistence[key]

if (!isEmptyValue(changes)) {
return Object.values(changes)
const valuesList = Object.values(changes)
if (isEmptyValue(recordUuid) || recordUuid === 'create-new') {
return valuesList
}
return valuesList
// only changes
.filter(attribute => {
const { value, oldValue } = attribute
Expand All @@ -489,23 +493,24 @@ const persistence = {
const changes = state.persistence[key]

if (!isEmptyValue(changes)) {
if (isEmptyValue(recordUuid)) {
const valuesList = Object.values(changes)
if (isEmptyValue(recordUuid) || recordUuid === 'create-new') {
const defaultRow = rootGetters.getTabParsedDefaultValue({
parentUuid,
containerUuid,
isAddDisplayColumn: true,
formatToReturn: 'object'
})

return Object.values(changes)
return valuesList
// only changes with default value
.filter(attribute => {
const { value, columnName } = attribute
return !isSameValues(value, defaultRow[columnName])
})
}

return Object.values(changes)
return valuesList
// only changes
.filter(attribute => {
const { value, oldValue } = attribute
Expand Down
1 change: 1 addition & 0 deletions src/utils/ADempiere/dictionary/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export function evaluateDefaultFieldShowed({
VALUE, DOCUMENT_NO, CURRENCY,
'DateInvoiced', 'DateOrdered', 'DatePromised',
'DateTrx', 'MovementDate', 'M_Product_ID', 'QtyEntered',
'ValidTo',
// TODO: Remove this columns with fixes default value
'UserLevel'
]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ADempiere/formatValue/numberFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function isNumber(value) {
if (isNaN(value)) {
return false
}
true
return true
}

/**
Expand Down

0 comments on commit e99da64

Please sign in to comment.