Skip to content

Commit

Permalink
fix: Date field on table records. (adempiere#1642)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Nov 17, 2023
1 parent 38ec8b1 commit 51ae95f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
11 changes: 10 additions & 1 deletion src/components/ADempiere/FieldDefinition/FieldDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,16 @@ export default {
if (inTable) {
// implement container manager row
if (this.containerManager && this.containerManager.getCell) {
return this.containerManager.getCell({
const value = this.containerManager.getCell({
containerUuid,
rowIndex: this.metadata.rowIndex,
columnName
})
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
}
}

Expand All @@ -163,6 +168,10 @@ export default {
// if (!isEmptyValue(value)) {
// return value.map(val => new Date(val))
// }
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
}
if (!this.isRenderRange) {
Expand Down
10 changes: 4 additions & 6 deletions src/components/ADempiere/FieldDefinition/mixin/mixinField.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,11 @@ export default {
rowIndex: this.metadata.rowIndex,
columnName
})
if (!isEmptyValue(value)) {
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
}
}

Expand Down
18 changes: 14 additions & 4 deletions src/components/ADempiere/FieldDefinition/useFieldDefinition.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
* Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Contributor(s): Edwin Betancourt [email protected] https://github.com/EdwinBetanc0urt
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -21,7 +21,7 @@ import { computed, onMounted } from '@vue/composition-api'
import store from '@/store'

// Utils and Helpers Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { getTypeOfValue, isEmptyValue } from '@/utils/ADempiere/valueUtils'

export default function useFieldDefinition({ fieldMetadata, containerManager }) {
const isMobile = computed(() => {
Expand Down Expand Up @@ -91,20 +91,30 @@ export default function useFieldDefinition({ fieldMetadata, containerManager })
if (inTable) {
// implement container manager row
if (containerManager && containerManager.getCell) {
return containerManager.getCell({
const value = containerManager.getCell({
containerUuid,
rowIndex: fieldMetadata.rowIndex,
columnName
})
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
}
}

// main panel values
return store.getters.getValueOfFieldOnContainer({
const value = store.getters.getValueOfFieldOnContainer({
parentUuid: fieldMetadata.parentUuid,
containerUuid,
columnName
})
// types `decimal` and `date` is a object struct
if ((getTypeOfValue(value) === 'OBJECT') && !isEmptyValue(value.type)) {
return value.value
}
return value
},
set(newValue) {
const { columnName, containerUuid, inTable } = fieldMetadata
Expand Down

0 comments on commit 51ae95f

Please sign in to comment.