fix #341 Send double values with 0 values in decimals (#342)

* fix convert float values to double values with grpc.

* Update package.json

* fix send double values with callout.

* Change Double value to Decimal value.

* fixed FIELDS_FLOATS to FIELDS_DECIMALS

* Change references by correct valuess Q

* Update version for data management

* Add support to latest version for data 2.1.6

Co-authored-by: Yamel Senih <ysenih@erpya.com>
pull/3759/head
Edwin Betancourt 2020-04-07 02:46:50 -04:00 committed by GitHub
parent f9187f2795
commit 8385415ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 78 additions and 23 deletions

View File

@ -45,7 +45,7 @@
},
"dependencies": {
"@adempiere/grpc-access-client": "^1.1.8",
"@adempiere/grpc-data-client": "^2.1.2",
"@adempiere/grpc-data-client": "^2.1.6",
"@adempiere/grpc-dictionary-client": "^1.3.5",
"@adempiere/grpc-enrollment-client": "^1.0.7",
"autoprefixer": "^9.5.1",

View File

@ -264,7 +264,7 @@ export function getReferencesList({ windowUuid, tableName, recordId, recordUuid,
* @param {array} attributesList
* @returns {Map} Entity
*/
export function runCallOutRequest({ windowUuid, windowNo, tabUuid, tableName, columnName, value, oldValue, callout, attributesList = [] }) {
export function runCallOutRequest({ windowUuid, windowNo, tabUuid, tableName, columnName, value, oldValue, valueType, callout, attributesList = [] }) {
return Instance.call(this).requestRunCallout({
windowUuid,
windowNo,
@ -273,6 +273,7 @@ export function runCallOutRequest({ windowUuid, windowNo, tabUuid, tableName, co
columnName,
value,
oldValue,
valueType,
callout,
attributesList
})

View File

@ -251,7 +251,7 @@ import IconElement from '@/components/ADempiere/IconElement'
import { formatDate } from '@/filters/ADempiere'
import MainPanel from '@/components/ADempiere/Panel'
import { sortFields } from '@/utils/ADempiere/dictionaryUtils'
import { FIELDS_FLOATS, FIELDS_QUANTITY, FIELD_READ_ONLY_FORM } from '@/components/ADempiere/Field/references'
import { FIELDS_DECIMALS, FIELDS_QUANTITY, FIELD_READ_ONLY_FORM } from '@/components/ADempiere/Field/references'
import { fieldIsDisplayed } from '@/utils/ADempiere'
import evaluator from '@/utils/ADempiere/evaluator'
@ -996,7 +996,7 @@ export default {
formatNumber({ referenceType, number }) {
let fixed = 0
// Amount, Costs+Prices, Number
if (FIELDS_FLOATS.includes(referenceType)) {
if (FIELDS_DECIMALS.includes(referenceType)) {
fixed = 2
}
return new Intl.NumberFormat().format(number.toFixed(fixed))

View File

@ -22,7 +22,7 @@
<script>
import { fieldMixin } from '@/components/ADempiere/Field/FieldMixin'
import { FIELDS_FLOATS } from '@/components/ADempiere/Field/references'
import { FIELDS_DECIMALS } from '@/components/ADempiere/Field/references'
export default {
name: 'FieldNumber',
@ -63,7 +63,7 @@ export default {
},
precision() {
// Amount, Costs+Prices, Number
if (FIELDS_FLOATS.includes(this.metadata.referenceType)) {
if (FIELDS_DECIMALS.includes(this.metadata.referenceType)) {
return 2
}
return undefined

View File

@ -1,11 +1,17 @@
// All references
/**
* All references
* {number} id: Identifiert to field reference
* {string|array} valueType: to convert and send server with gRPC
* {boolean} isSupported: Indicate if field is suported
*/
const REFERENCES = [
{
id: 25,
type: 'FieldText',
support: false,
description: 'Account Element',
valueType: 'INTEGER',
alias: ['Account']
},
{
@ -13,6 +19,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: 'Number with 4 decimals',
valueType: 'DECIMAL',
alias: ['Amount']
},
{
@ -20,6 +27,7 @@ const REFERENCES = [
type: 'FieldText',
support: false,
description: 'Resource Assignment',
valueType: 'INTEGER',
alias: ['Assignment']
},
{
@ -27,13 +35,16 @@ const REFERENCES = [
type: 'FieldBinary',
support: true,
description: 'Binary Data',
valueType: 'INTEGER',
alias: ['Binary']
},
{
// this component is hidden
id: 28,
type: 'FieldButton',
support: true,
description: 'Command Button - starts a process',
valueType: 'STRING',
alias: ['Button']
},
{
@ -41,6 +52,7 @@ const REFERENCES = [
type: 'FieldText',
support: false,
description: 'Chart',
valueType: 'INTEGER',
alias: ['Chart']
},
{
@ -48,6 +60,7 @@ const REFERENCES = [
type: 'FieldText',
support: false,
description: 'Color element',
valueType: 'INTEGER',
alias: ['Color']
},
{
@ -55,6 +68,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: 'Costs + Prices (minimum currency precision but if exists more)',
valueType: 'DECIMAL',
alias: ['Costs+Prices', 'CostsPrices', 'Cost Prices']
},
{
@ -62,6 +76,7 @@ const REFERENCES = [
type: 'FieldDate',
support: true,
description: 'Date mm/dd/yyyy',
valueType: 'DATE',
alias: ['Date']
},
{
@ -69,6 +84,7 @@ const REFERENCES = [
type: 'FieldDate',
support: true,
description: 'Date with time',
valueType: 'DATE',
alias: ['DateTime', 'Date Time', 'Date+Time']
},
{
@ -76,6 +92,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Local File',
valueType: 'STRING',
alias: ['FileName', 'File Name']
},
{
@ -83,6 +100,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Local File Path',
valueType: 'STRING',
alias: ['FilePath', 'File Path']
},
{
@ -90,6 +108,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Local File Path or Name',
valueType: 'STRING',
alias: ['FilePathOrName', 'File Path Or Name']
},
{
@ -97,6 +116,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: '10 Digit Identifier',
valueType: 'INTEGER',
alias: ['ID']
},
{
@ -104,6 +124,7 @@ const REFERENCES = [
type: 'FieldImage',
support: true,
description: 'Binary Image Data',
valueType: 'INTEGER',
alias: ['Image']
},
{
@ -111,6 +132,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: '10 Digit numeric',
valueType: 'INTEGER',
alias: ['Integer']
},
{
@ -118,6 +140,7 @@ const REFERENCES = [
type: 'FieldSelect',
support: true,
description: 'Reference List',
valueType: 'STRING',
alias: ['List']
},
{
@ -125,6 +148,7 @@ const REFERENCES = [
type: 'FieldText',
support: false,
description: 'Location/Address',
valueType: 'INTEGER',
alias: ['Location', 'Location (Address)', 'Location/Address']
},
{
@ -132,12 +156,14 @@ const REFERENCES = [
type: 'FieldSelect',
support: true,
description: 'Warehouse Locator Data type',
valueType: 'INTEGER',
alias: ['Locator', 'Locator (WH)', 'Locator/WH']
},
{
id: 34,
type: 'FieldTextLong',
support: true,
valueType: 'STRING',
description: 'Reference List',
alias: ['Memo']
},
@ -146,6 +172,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: 'Float Number',
valueType: 'DECIMAL',
alias: ['Number']
},
{
@ -153,6 +180,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Printer Name',
valueType: 'STRING',
alias: ['PrinterName', 'Printer Name']
},
{
@ -160,6 +188,7 @@ const REFERENCES = [
type: 'FieldText',
support: false,
description: 'Product Attribute',
valueType: 'INTEGER',
alias: ['ProductAttribute', 'Product Attribute']
},
{
@ -167,6 +196,7 @@ const REFERENCES = [
type: 'FieldNumber',
support: true,
description: 'Quantity data type',
valueType: 'DECIMAL',
alias: ['Quantity']
},
{
@ -174,6 +204,7 @@ const REFERENCES = [
type: 'FieldSelect',
support: true,
description: 'Search Field',
valueType: 'INTEGER',
alias: ['Search']
},
{
@ -181,6 +212,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Character String',
valueType: 'STRING',
alias: ['String']
},
{
@ -188,6 +220,7 @@ const REFERENCES = [
type: 'FieldSelect',
support: true,
description: 'Table List',
valueType: 'INTEGER',
alias: ['Table']
},
{
@ -195,6 +228,7 @@ const REFERENCES = [
type: 'FieldSelect',
support: true,
description: 'Direct Table Access',
valueType: 'INTEGER',
alias: ['TableDirect', 'Table Direct']
},
{
@ -202,6 +236,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'Character String up to 2000 characters',
valueType: 'STRING',
alias: ['Text']
},
{
@ -209,6 +244,7 @@ const REFERENCES = [
type: 'FieldTextLong',
support: true,
description: 'Text (Long) - Text > 2000 characters',
valueType: 'STRING',
alias: ['TextLong', 'Text Long']
},
{
@ -216,6 +252,7 @@ const REFERENCES = [
type: 'FieldTime',
support: true,
description: 'Time',
valueType: 'DATE',
alias: ['Time']
},
{
@ -223,6 +260,7 @@ const REFERENCES = [
type: 'FieldText',
support: true,
description: 'URL',
valueType: 'STRING',
alias: ['URL', 'Url']
},
{
@ -230,6 +268,7 @@ const REFERENCES = [
type: 'FieldYesNo',
support: true,
description: 'CheckBox',
valueType: 'BOOLEAN',
alias: ['YesNo', 'Yes No', 'Yes-No']
}
]
@ -319,6 +358,6 @@ export const FIELD_READ_ONLY_FORM = [
}
]
export const FIELDS_FLOATS = ['Amount', 'Costs+Prices', 'Number']
export const FIELDS_DECIMALS = ['Amount', 'Costs+Prices', 'Number', 'Quantity']
export const FIELDS_QUANTITY = ['Amount', 'Costs+Prices', 'Integer', 'Number', 'Quantity']

View File

@ -17,6 +17,8 @@ import VueResize from 'vue-resize'
*/
import VMarkdown from 'v-markdown/src'
import VueShortkey from 'vue-shortkey'
import '@/styles/index.scss' // global css
import App from './App'
@ -44,6 +46,7 @@ if (process.env.NODE_ENV === 'production') {
mockXHR()
}
Vue.use(VMarkdown)
Vue.use(VueShortkey)
Vue.use(VueSplit)
Vue.use(VueResize)
Vue.use(Element, {
@ -63,8 +66,6 @@ Object.keys(globalMethods).forEach(key => {
Vue.config.productionTip = false
Vue.use(require('vue-shortkey'))
new Vue({
el: '#app',
router,

View File

@ -28,7 +28,8 @@ const callOutControl = {
inTable = false,
row,
value,
oldValue
oldValue,
valueType
}) {
return new Promise((resolve, reject) => {
const window = rootGetters.getWindow(parentUuid)

View File

@ -742,6 +742,7 @@ const data = {
columnName: field.columnName,
callout: field.callout,
value: newValue,
valueType: field.valueType,
withOutColumnNames,
row,
inTable: true

View File

@ -647,6 +647,7 @@ const panel = {
callout: field.callout,
value: newValue,
oldValue: field.oldValue,
valueType: field.valueType,
withOutColumnNames
})
}
@ -1163,13 +1164,15 @@ const panel = {
attributesObject[`${fieldItem.columnName}_To`] = fieldItem.valueTo
rangeColumnsList.push({
columnName: `${fieldItem.columnName}_To`,
value: fieldItem.valueTo
value: fieldItem.valueTo,
valueType: fieldItem.valueType
})
}
return {
columnName: fieldItem.columnName,
value: valueToReturn
value: valueToReturn,
valueType: fieldItem.valueType
}
})
@ -1420,6 +1423,7 @@ const panel = {
parametersRange.push({
columnName: `${parameterItem.columnName}_To`,
operator,
valueType: parameterItem.valueType,
value: valueTo
})
operator = 'GREATER_EQUAL' // rewrite to assign first position of array
@ -1428,6 +1432,7 @@ const panel = {
return {
columnName: parameterItem.columnName,
value,
valueType: parameterItem.valueType,
isRange: parameterItem.isRange,
values,
operator

View File

@ -82,7 +82,7 @@ const windowControl = {
containerUuid,
propertyName: 'value',
isEvaluateValues: true,
isAddDisplayColumn: true
isAddDisplayColumn: false
})
commit('addInCreate', {
@ -187,27 +187,33 @@ const windowControl = {
// TODO: Evaluate peformance without filter using delete(prop) before convert object to array
// attributes or fields
let finalAttributes = convertObjectToArrayPairs(row)
finalAttributes = finalAttributes.filter(itemAttribute => {
if (isEmptyValue(itemAttribute.value)) {
return false
}
const fieldsList = getters.getFieldsListFromPanel(containerUuid)
const attributesList = []
fieldsList.forEach(itemAttribute => {
if (columnsToDontSend.includes(itemAttribute.columnName) || itemAttribute.columnName.includes('DisplayColumn')) {
return false
}
return true
if (isEmptyValue(row[itemAttribute.columnName])) {
return false
}
attributesList.push({
value: row[itemAttribute.columnName],
columnName: itemAttribute.columnName,
valueType: itemAttribute.valueType
})
})
commit('addInCreate', {
containerUuid,
tableName,
attributesList: finalAttributes
attributesList
})
let isError = false
return createEntity({
tableName,
attributesList: finalAttributes
attributesList
})
.then(createEntityResponse => {
showMessage({
@ -257,7 +263,7 @@ const windowControl = {
commit('deleteInCreate', {
containerUuid,
tableName,
attributesList: finalAttributes
attributesList
})
})
},

View File

@ -182,6 +182,7 @@ export function generateField({
isShowedFromUserDefault: isShowedFromUser, // set this value when reset panel
isShowedTableFromUser: fieldToGenerate.isDisplayed,
isFixedTableColumn: false,
valueType: componentReference.valueType, // value type to convert with gGRPC
isSQLValue,
// Advanced query
operator, // current operator