From 737d85b0ba74bb704f38906b3f3248f8ec70fe88 Mon Sep 17 00:00:00 2001
From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com>
Date: Thu, 11 Feb 2021 11:55:45 -0400
Subject: [PATCH] Point of Sale Processes (#583)
* Cancel sale transaction
* minimal change
* Copy Order
* Copy Line the Order
* add Traslation
---
src/api/ADempiere/form/point-of-sales.js | 18 ++-
src/components/ADempiere/Dialog/index.vue | 127 ++++++++-------
.../ADempiere/Form/VPOS/Options/index.vue | 119 ++++++++++++--
.../ADempiere/Form/VPOS/Order/index.vue | 9 +-
.../ADempiere/Form/VPOS/OrderList/index.vue | 19 ++-
.../ADempiere/Form/VPOS/posMixin.js | 43 ++++-
src/lang/ADempiere/en.js | 4 +-
src/lang/ADempiere/es.js | 4 +-
.../ADempiere/pointOfSales/collection.js | 5 -
.../modules/ADempiere/pointOfSales/index.js | 21 ++-
.../modules/ADempiere/pointOfSales/order.js | 4 +-
.../modules/ADempiere/process/actions.js | 150 +++++++++++++++++-
src/store/modules/ADempiere/utils.js | 22 ++-
src/utils/ADempiere/constants/posProcess.js | 27 ++++
src/views/ADempiere/Form/index.vue | 9 +-
15 files changed, 474 insertions(+), 107 deletions(-)
create mode 100644 src/utils/ADempiere/constants/posProcess.js
diff --git a/src/api/ADempiere/form/point-of-sales.js b/src/api/ADempiere/form/point-of-sales.js
index a98f2927..5c9b8643 100644
--- a/src/api/ADempiere/form/point-of-sales.js
+++ b/src/api/ADempiere/form/point-of-sales.js
@@ -125,18 +125,20 @@ export function requestGetOrder(orderUuid) {
// Create order from POS
export function requestDeleteOrder({
- posUuid,
- customerUuid,
- documentTypeUuid,
- salesRepresentativeUuid
+ orderUuid
+ // posUuid,
+ // customerUuid,
+ // documentTypeUuid,
+ // salesRepresentativeUuid
}) {
return requestRest({
url: '/pos/delete-order',
data: {
- pos_uuid: posUuid,
- customer_uuid: customerUuid,
- document_type_uuid: documentTypeUuid,
- sales_representative_uuid: salesRepresentativeUuid
+ order_uuid: orderUuid
+ // pos_uuid: posUuid,
+ // customer_uuid: customerUuid,
+ // document_type_uuid: documentTypeUuid,
+ // sales_representative_uuid: salesRepresentativeUuid
}
})
.then(evaluateResponse)
diff --git a/src/components/ADempiere/Dialog/index.vue b/src/components/ADempiere/Dialog/index.vue
index 9bc375c0..c09c10e3 100644
--- a/src/components/ADempiere/Dialog/index.vue
+++ b/src/components/ADempiere/Dialog/index.vue
@@ -10,26 +10,30 @@
close-on-click-modal
>
{{ modalMetadata.description }}
-
+
+
+ {{ $t('form.pos.optionsPoinSales.salesOrder.copyOrderLine') }}
+
{
console.info(`VPOS/Options component (New Order): ${error.message}`)
}).finally(() => {
- const { templateBusinessPartner } = this.currentPOS
-
+ // const { templateBusinessPartner } = this.currentPOS
this.$store.commit('updateValuesOfContainer', {
containerUuid: this.metadata.containerUuid,
attributes: [{
@@ -375,15 +413,15 @@ export default {
},
{
columnName: 'C_BPartner_ID',
- value: templateBusinessPartner.id
+ value: 1000006
},
{
columnName: 'DisplayColumn_C_BPartner_ID',
- value: templateBusinessPartner.name
+ value: 'Cliente Unico'
},
{
columnName: ' C_BPartner_ID_UUID',
- value: templateBusinessPartner.uuid
+ value: '9f6cf428-9209-11e9-8046-0242ac140002'
}]
})
@@ -417,9 +455,33 @@ export default {
})
},
reverseSalesTransaction() {
- // TODO: Add BPartner
- requestReverseSalesTransaction({
- orderUuid: this.$route.query.action
+ const process = this.$store.getters.getProcess(posProcess[1].uuid)
+ this.$store.dispatch('startProcess', {
+ action: process,
+ isProcessTableSelection: false,
+ containerUuid: process.containerUuid,
+ parametersList: [
+ {
+ columnName: 'C_Order_ID',
+ value: this.currentPOS.id
+ },
+ {
+ columnName: 'Bill_BPartner_ID',
+ value: this.currentPOS.businessPartner.id
+ },
+ {
+ columnName: 'IsCancelled',
+ value: false
+ },
+ {
+ columnName: 'IsShipConfirm',
+ value: true
+ },
+ {
+ columnName: 'C_DocTypeRMA_ID',
+ value: 'VO'
+ }
+ ]
})
},
createWithdrawal() {
@@ -435,6 +497,25 @@ export default {
orderUuid: this.$route.query.action
})
},
+ showModal(action) {
+ this.$store.dispatch('setShowDialog', {
+ type: action.type,
+ action: {
+ ...action,
+ containerUuid: action.uuid
+ }
+ })
+ },
+ copyOrder() {
+ this.processPos = posProcess[5].uuid
+ const process = this.$store.getters.getProcess(posProcess[5].uuid)
+ this.showModal(process)
+ },
+ copyLineOrder() {
+ this.processPos = posProcess[5].uuid
+ const process = this.$store.getters.getProcess(posProcess[5].uuid)
+ this.showModal(process)
+ },
cashClosing() {
const { uuid: posUuid, id: posId } = this.getCurrentPOS
requestCashClosing({
@@ -446,7 +527,19 @@ export default {
requestDeleteOrder({
orderUuid: this.$route.query.action
})
- this.newOrder()
+ .then(response => {
+ this.changePos(this.$store.getters.getCurrentPOS)
+ })
+ .finally(() => {
+ this.$store.dispatch('listOrdersFromServer', {
+ posUuid: this.$store.getters.getCurrentPOS.uuid
+ })
+ this.$message({
+ type: 'success',
+ message: 'Orden Cancelada',
+ showClose: true
+ })
+ })
}
}
}
diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue
index 972cdee9..a6a29c05 100644
--- a/src/components/ADempiere/Form/VPOS/Order/index.vue
+++ b/src/components/ADempiere/Form/VPOS/Order/index.vue
@@ -50,6 +50,7 @@