From eb4b746a9a4f683b1baa103d413bd0693f7daf8b Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Fri, 5 Mar 2021 12:08:57 -0400 Subject: [PATCH] Bugfix/fix point router on initial load (#630) * add complete order from collection * call the edit line fields only when they are displayed * unnecessary calling of customer fields * minimal changes * Add point id to the route on initial load Co-authored-by: Elsio Sanchez --- src/api/ADempiere/form/point-of-sales.js | 2 +- .../ADempiere/Form/VPOS/Collection/index.vue | 5 ++++- src/components/ADempiere/Form/VPOS/index.vue | 3 --- src/components/ADempiere/Form/VPOS/posMixin.js | 18 +++++++++++++++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/api/ADempiere/form/point-of-sales.js b/src/api/ADempiere/form/point-of-sales.js index c1502a84..ac3569f4 100644 --- a/src/api/ADempiere/form/point-of-sales.js +++ b/src/api/ADempiere/form/point-of-sales.js @@ -584,7 +584,7 @@ export function requestProcessOrder({ amount: parameter.amount, tender_type_code: parameter.tenderTypeCode, payment_ate: parameter.paymentDate, - currency_uid: parameter.currency_uuid + currency_uid: parameter.currencyUuid } }) } diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index fa7470b0..f75f32cf 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -606,7 +606,7 @@ export default { amount: this.amontSend, paymentDate, tenderTypeCode, - currencyUuid: this.currencyDisplay(currencyToPay).currencyUuid + currencyUuid: this.currencyDisplay(currencyToPay) }) } this.addCollect() @@ -739,6 +739,9 @@ export default { if (display) { return display } + if (currency === this.currencyPoint.id) { + return this.currencyPoint.uuid + } return currency }, convertCurrency() { diff --git a/src/components/ADempiere/Form/VPOS/index.vue b/src/components/ADempiere/Form/VPOS/index.vue index d5f3bee4..d1ca1461 100644 --- a/src/components/ADempiere/Form/VPOS/index.vue +++ b/src/components/ADempiere/Form/VPOS/index.vue @@ -116,9 +116,6 @@ export default { if (this.isEmptyValue(this.$store.getters.getSellingPointsList)) { let posToSet // set pos id with query path - if (!this.isEmptyValue(this.$route.query) && !this.isEmptyValue(this.$route.query.pos)) { - posToSet = Number(this.$route.query.pos) - } this.$store.dispatch('listPointOfSalesFromServer', posToSet) } diff --git a/src/components/ADempiere/Form/VPOS/posMixin.js b/src/components/ADempiere/Form/VPOS/posMixin.js index 2a9ccdc5..86a5246b 100644 --- a/src/components/ADempiere/Form/VPOS/posMixin.js +++ b/src/components/ADempiere/Form/VPOS/posMixin.js @@ -133,6 +133,11 @@ export default { this.listOrderLines(value) } }, + currentPoint(value) { + if (!this.isEmptyValue(value)) { + this.$store.dispatch('setCurrentPOS', value) + } + }, /** * Used when loading/reloading the app without the order uuid * @param {oject|boolean} bPartnerToSet @@ -166,6 +171,17 @@ export default { if (!this.isEmptyValue(this.$route.query)) { this.reloadOrder(true, this.$route.query.action) } + if (!this.isEmptyValue(this.$route.query.pos) && !this.isEmptyValue(this.allOrderLines) && this.isEmptyValue(this.$route.query.action)) { + this.$router.push({ + params: { + ...this.$route.params + }, + query: { + ...this.$route.query, + action: this.getOrder.uuid + } + }, () => {}) + } }, methods: { formatDate, @@ -311,7 +327,7 @@ export default { this.createOrderLine(response.uuid) } this.$store.dispatch('listOrdersFromServer', { - posUuid: this.$store.getters.getCurrentPOS.uuid + posUuid: this.currentPoint.uuid }) }).catch(() => {}) })