From 70022f0f61611a238e593c6bb11bc7fc3878cf05 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 25 May 2021 16:20:10 -0400 Subject: [PATCH] search for the conversion date by the current date (#866) * search for the conversion date by the current date * search product * remove console.log Co-authored-by: elsiosanchez --- .../Form/VPOS/Collection/fieldsListCollection.js | 1 - .../ADempiere/Form/VPOS/Collection/index.vue | 16 ++++++++++++++-- .../ADempiere/Form/VPOS/ProductInfo/index.vue | 4 +--- .../Form/VPOS/ProductInfo/productList.vue | 12 ------------ .../ADempiere/pointOfSales/getters/index.js | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Collection/fieldsListCollection.js b/src/components/ADempiere/Form/VPOS/Collection/fieldsListCollection.js index 7a6c6bfa..c0fd828b 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/fieldsListCollection.js +++ b/src/components/ADempiere/Form/VPOS/Collection/fieldsListCollection.js @@ -53,7 +53,6 @@ export default [ columnName: 'TenderType', isFromDictionary: true, overwriteDefinition: { - defaultValue: 'X', handleActionKeyPerformed: true, handleContentSelection: true, handleActionPerformed: true, diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index 81d93e77..669f9e39 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -215,7 +215,7 @@ import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js' import fieldsListCollection from './fieldsListCollection.js' import typeCollection from '@/components/ADempiere/Form/VPOS/Collection/typeCollection' import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAmount/index' -import { formatDate, formatPrice } from '@/utils/ADempiere/valueFormat.js' +import { formatPrice } from '@/utils/ADempiere/valueFormat.js' import { processOrder } from '@/api/ADempiere/form/point-of-sales.js' import { FIELDS_DECIMALS } from '@/utils/ADempiere/references' @@ -500,6 +500,7 @@ export default { this.$store.dispatch('conversionDivideRate', { conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid, currencyFromUuid: this.pointOfSalesCurrency.uuid, + conversionDate: this.formatDate(new Date()), currencyToUuid: value }) } @@ -541,7 +542,6 @@ export default { this.defaultValueCurrency() }, methods: { - formatDate, formatNumber({ displayType, number }) { let fixed = 0 // Amount, Costs+Prices, Number @@ -813,6 +813,18 @@ export default { this.$store.dispatch('updatePaymentPos', false) }) }, + formatDate(date) { + let month = '' + (date.getMonth() + 1) + let day = '' + date.getDate() + const year = date.getFullYear() + if (month.length < 2) { + month = '0' + month + } + if (day.length < 2) { + day = '0' + day + } + return [year, month, day].join('-') + }, subscribeChanges() { return this.$store.subscribe((mutation, state) => { if (mutation.type === 'updateValueOfField') { diff --git a/src/components/ADempiere/Form/VPOS/ProductInfo/index.vue b/src/components/ADempiere/Form/VPOS/ProductInfo/index.vue index 1549673b..b1585ed8 100644 --- a/src/components/ADempiere/Form/VPOS/ProductInfo/index.vue +++ b/src/components/ADempiere/Form/VPOS/ProductInfo/index.vue @@ -173,15 +173,13 @@ export default { } let results = this.listWithPrice - if (stringToMatch) { + if (!this.isEmptyValue(stringToMatch)) { const parsedValue = stringToMatch.toLowerCase().trim() results = results.filter(rowProduct => { const productAttributes = rowProduct.product - for (const columnProductPrice in productAttributes) { const valueToCompare = String(productAttributes[columnProductPrice]).toLowerCase() - if (valueToCompare.includes(parsedValue)) { return true } diff --git a/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue b/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue index 1df7d1e7..716d6205 100644 --- a/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue +++ b/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue @@ -147,18 +147,6 @@ export default { return (!isLoaded || isReload) // && this.isShowProductsPriceList } }, - watch: { - isReadyFromGetData(isToLoad) { - if (isToLoad) { - this.loadProductsPricesList() - } - } - // currentPointOfSales(value) { - // if (!this.isEmptyValue(value)) { - // this.loadProductsPricesList() - // } - // } - }, created() { this.unsubscribe = this.subscribeChanges() this.$store.commit('setListProductPrice', { diff --git a/src/store/modules/ADempiere/pointOfSales/getters/index.js b/src/store/modules/ADempiere/pointOfSales/getters/index.js index 80197da2..eff94cc2 100644 --- a/src/store/modules/ADempiere/pointOfSales/getters/index.js +++ b/src/store/modules/ADempiere/pointOfSales/getters/index.js @@ -67,7 +67,7 @@ export default { * Search Product */ getProductPrice: (state) => { - if (isEmptyValue(state.productPrice) || !state.productPrice.isLoaded) { + if (isEmptyValue(state.productPrice)) { return { ...withoutResponse, productPricesList: []