From e2bbc598a7d690b02d0a0e70fb80daa72cd0ae5a Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 9 Feb 2021 11:37:18 -0400 Subject: [PATCH] error correction with default point of sale with sales representative (#582) * error correction with default point of sale with sales representative * minimal change --- src/components/ADempiere/Form/PriceChecking/index.vue | 4 +--- src/store/modules/ADempiere/pointOfSales/index.js | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/ADempiere/Form/PriceChecking/index.vue b/src/components/ADempiere/Form/PriceChecking/index.vue index a7f8d21f..54947a54 100644 --- a/src/components/ADempiere/Form/PriceChecking/index.vue +++ b/src/components/ADempiere/Form/PriceChecking/index.vue @@ -130,9 +130,7 @@ export default { } }, created() { - if (this.isEmptyValue(this.currentPoint)) { - this.$store.dispatch('listPointOfSalesFromServer') - } + this.$store.dispatch('listPointOfSalesFromServer') this.unsubscribe = this.subscribeChanges() }, mounted() { diff --git a/src/store/modules/ADempiere/pointOfSales/index.js b/src/store/modules/ADempiere/pointOfSales/index.js index 853e05d4..ad045526 100644 --- a/src/store/modules/ADempiere/pointOfSales/index.js +++ b/src/store/modules/ADempiere/pointOfSales/index.js @@ -136,7 +136,12 @@ const pointOfSales = { return currentPOS.uuid }, // current pos info - getCurrentPOS: (state) => { + getCurrentPOS: (state, getters) => { + const userUuid = getters['user/getUserUuid'] + const sellingPointsList = state.pointOfSales.sellingPointsList.length + if (sellingPointsList > 1) { + return state.pointOfSales.sellingPointsList.find(elem => elem.salesRepresentative.uuid === userUuid) + } if (isEmptyValue(state.pointOfSales)) { return undefined }