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": { "dependencies": {
"@adempiere/grpc-access-client": "^1.1.8", "@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-dictionary-client": "^1.3.5",
"@adempiere/grpc-enrollment-client": "^1.0.7", "@adempiere/grpc-enrollment-client": "^1.0.7",
"autoprefixer": "^9.5.1", "autoprefixer": "^9.5.1",

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<script> <script>
import { fieldMixin } from '@/components/ADempiere/Field/FieldMixin' 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 { export default {
name: 'FieldNumber', name: 'FieldNumber',
@ -63,7 +63,7 @@ export default {
}, },
precision() { precision() {
// Amount, Costs+Prices, Number // Amount, Costs+Prices, Number
if (FIELDS_FLOATS.includes(this.metadata.referenceType)) { if (FIELDS_DECIMALS.includes(this.metadata.referenceType)) {
return 2 return 2
} }
return undefined 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 = [ const REFERENCES = [
{ {
id: 25, id: 25,
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Account Element', description: 'Account Element',
valueType: 'INTEGER',
alias: ['Account'] alias: ['Account']
}, },
{ {
@ -13,6 +19,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: 'Number with 4 decimals', description: 'Number with 4 decimals',
valueType: 'DECIMAL',
alias: ['Amount'] alias: ['Amount']
}, },
{ {
@ -20,6 +27,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Resource Assignment', description: 'Resource Assignment',
valueType: 'INTEGER',
alias: ['Assignment'] alias: ['Assignment']
}, },
{ {
@ -27,13 +35,16 @@ const REFERENCES = [
type: 'FieldBinary', type: 'FieldBinary',
support: true, support: true,
description: 'Binary Data', description: 'Binary Data',
valueType: 'INTEGER',
alias: ['Binary'] alias: ['Binary']
}, },
{ {
// this component is hidden
id: 28, id: 28,
type: 'FieldButton', type: 'FieldButton',
support: true, support: true,
description: 'Command Button - starts a process', description: 'Command Button - starts a process',
valueType: 'STRING',
alias: ['Button'] alias: ['Button']
}, },
{ {
@ -41,6 +52,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Chart', description: 'Chart',
valueType: 'INTEGER',
alias: ['Chart'] alias: ['Chart']
}, },
{ {
@ -48,6 +60,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Color element', description: 'Color element',
valueType: 'INTEGER',
alias: ['Color'] alias: ['Color']
}, },
{ {
@ -55,6 +68,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: 'Costs + Prices (minimum currency precision but if exists more)', description: 'Costs + Prices (minimum currency precision but if exists more)',
valueType: 'DECIMAL',
alias: ['Costs+Prices', 'CostsPrices', 'Cost Prices'] alias: ['Costs+Prices', 'CostsPrices', 'Cost Prices']
}, },
{ {
@ -62,6 +76,7 @@ const REFERENCES = [
type: 'FieldDate', type: 'FieldDate',
support: true, support: true,
description: 'Date mm/dd/yyyy', description: 'Date mm/dd/yyyy',
valueType: 'DATE',
alias: ['Date'] alias: ['Date']
}, },
{ {
@ -69,6 +84,7 @@ const REFERENCES = [
type: 'FieldDate', type: 'FieldDate',
support: true, support: true,
description: 'Date with time', description: 'Date with time',
valueType: 'DATE',
alias: ['DateTime', 'Date Time', 'Date+Time'] alias: ['DateTime', 'Date Time', 'Date+Time']
}, },
{ {
@ -76,6 +92,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Local File', description: 'Local File',
valueType: 'STRING',
alias: ['FileName', 'File Name'] alias: ['FileName', 'File Name']
}, },
{ {
@ -83,6 +100,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Local File Path', description: 'Local File Path',
valueType: 'STRING',
alias: ['FilePath', 'File Path'] alias: ['FilePath', 'File Path']
}, },
{ {
@ -90,6 +108,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Local File Path or Name', description: 'Local File Path or Name',
valueType: 'STRING',
alias: ['FilePathOrName', 'File Path Or Name'] alias: ['FilePathOrName', 'File Path Or Name']
}, },
{ {
@ -97,6 +116,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: '10 Digit Identifier', description: '10 Digit Identifier',
valueType: 'INTEGER',
alias: ['ID'] alias: ['ID']
}, },
{ {
@ -104,6 +124,7 @@ const REFERENCES = [
type: 'FieldImage', type: 'FieldImage',
support: true, support: true,
description: 'Binary Image Data', description: 'Binary Image Data',
valueType: 'INTEGER',
alias: ['Image'] alias: ['Image']
}, },
{ {
@ -111,6 +132,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: '10 Digit numeric', description: '10 Digit numeric',
valueType: 'INTEGER',
alias: ['Integer'] alias: ['Integer']
}, },
{ {
@ -118,6 +140,7 @@ const REFERENCES = [
type: 'FieldSelect', type: 'FieldSelect',
support: true, support: true,
description: 'Reference List', description: 'Reference List',
valueType: 'STRING',
alias: ['List'] alias: ['List']
}, },
{ {
@ -125,6 +148,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Location/Address', description: 'Location/Address',
valueType: 'INTEGER',
alias: ['Location', 'Location (Address)', 'Location/Address'] alias: ['Location', 'Location (Address)', 'Location/Address']
}, },
{ {
@ -132,12 +156,14 @@ const REFERENCES = [
type: 'FieldSelect', type: 'FieldSelect',
support: true, support: true,
description: 'Warehouse Locator Data type', description: 'Warehouse Locator Data type',
valueType: 'INTEGER',
alias: ['Locator', 'Locator (WH)', 'Locator/WH'] alias: ['Locator', 'Locator (WH)', 'Locator/WH']
}, },
{ {
id: 34, id: 34,
type: 'FieldTextLong', type: 'FieldTextLong',
support: true, support: true,
valueType: 'STRING',
description: 'Reference List', description: 'Reference List',
alias: ['Memo'] alias: ['Memo']
}, },
@ -146,6 +172,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: 'Float Number', description: 'Float Number',
valueType: 'DECIMAL',
alias: ['Number'] alias: ['Number']
}, },
{ {
@ -153,6 +180,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Printer Name', description: 'Printer Name',
valueType: 'STRING',
alias: ['PrinterName', 'Printer Name'] alias: ['PrinterName', 'Printer Name']
}, },
{ {
@ -160,6 +188,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: false, support: false,
description: 'Product Attribute', description: 'Product Attribute',
valueType: 'INTEGER',
alias: ['ProductAttribute', 'Product Attribute'] alias: ['ProductAttribute', 'Product Attribute']
}, },
{ {
@ -167,6 +196,7 @@ const REFERENCES = [
type: 'FieldNumber', type: 'FieldNumber',
support: true, support: true,
description: 'Quantity data type', description: 'Quantity data type',
valueType: 'DECIMAL',
alias: ['Quantity'] alias: ['Quantity']
}, },
{ {
@ -174,6 +204,7 @@ const REFERENCES = [
type: 'FieldSelect', type: 'FieldSelect',
support: true, support: true,
description: 'Search Field', description: 'Search Field',
valueType: 'INTEGER',
alias: ['Search'] alias: ['Search']
}, },
{ {
@ -181,6 +212,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Character String', description: 'Character String',
valueType: 'STRING',
alias: ['String'] alias: ['String']
}, },
{ {
@ -188,6 +220,7 @@ const REFERENCES = [
type: 'FieldSelect', type: 'FieldSelect',
support: true, support: true,
description: 'Table List', description: 'Table List',
valueType: 'INTEGER',
alias: ['Table'] alias: ['Table']
}, },
{ {
@ -195,6 +228,7 @@ const REFERENCES = [
type: 'FieldSelect', type: 'FieldSelect',
support: true, support: true,
description: 'Direct Table Access', description: 'Direct Table Access',
valueType: 'INTEGER',
alias: ['TableDirect', 'Table Direct'] alias: ['TableDirect', 'Table Direct']
}, },
{ {
@ -202,6 +236,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'Character String up to 2000 characters', description: 'Character String up to 2000 characters',
valueType: 'STRING',
alias: ['Text'] alias: ['Text']
}, },
{ {
@ -209,6 +244,7 @@ const REFERENCES = [
type: 'FieldTextLong', type: 'FieldTextLong',
support: true, support: true,
description: 'Text (Long) - Text > 2000 characters', description: 'Text (Long) - Text > 2000 characters',
valueType: 'STRING',
alias: ['TextLong', 'Text Long'] alias: ['TextLong', 'Text Long']
}, },
{ {
@ -216,6 +252,7 @@ const REFERENCES = [
type: 'FieldTime', type: 'FieldTime',
support: true, support: true,
description: 'Time', description: 'Time',
valueType: 'DATE',
alias: ['Time'] alias: ['Time']
}, },
{ {
@ -223,6 +260,7 @@ const REFERENCES = [
type: 'FieldText', type: 'FieldText',
support: true, support: true,
description: 'URL', description: 'URL',
valueType: 'STRING',
alias: ['URL', 'Url'] alias: ['URL', 'Url']
}, },
{ {
@ -230,6 +268,7 @@ const REFERENCES = [
type: 'FieldYesNo', type: 'FieldYesNo',
support: true, support: true,
description: 'CheckBox', description: 'CheckBox',
valueType: 'BOOLEAN',
alias: ['YesNo', 'Yes No', 'Yes-No'] 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'] 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 VMarkdown from 'v-markdown/src'
import VueShortkey from 'vue-shortkey'
import '@/styles/index.scss' // global css import '@/styles/index.scss' // global css
import App from './App' import App from './App'
@ -44,6 +46,7 @@ if (process.env.NODE_ENV === 'production') {
mockXHR() mockXHR()
} }
Vue.use(VMarkdown) Vue.use(VMarkdown)
Vue.use(VueShortkey)
Vue.use(VueSplit) Vue.use(VueSplit)
Vue.use(VueResize) Vue.use(VueResize)
Vue.use(Element, { Vue.use(Element, {
@ -63,8 +66,6 @@ Object.keys(globalMethods).forEach(key => {
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(require('vue-shortkey'))
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,

View File

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

View File

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

View File

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

View File

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

View File

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