diff --git a/src/components/ADempiere/Form/VPOS/Options/index.vue b/src/components/ADempiere/Form/VPOS/Options/index.vue index 155118ae..3fa7d7a4 100644 --- a/src/components/ADempiere/Form/VPOS/Options/index.vue +++ b/src/components/ADempiere/Form/VPOS/Options/index.vue @@ -32,6 +32,7 @@ placement="right" width="800" trigger="click" + @show="seeOrderList" > - -

- -
- {{ $t('form.pos.optionsPoinSales.salesOrder.copyOrderLine') }} -

-
-
- +

- - @@ -298,7 +261,8 @@ import { requestCreateWithdrawal, requestCreateNewCustomerReturnOrder, requestCashClosing, - requestDeleteOrder + requestDeleteOrder, + requestCreateOrder } from '@/api/ADempiere/form/point-of-sales.js' import ModalDialog from '@/components/ADempiere/Dialog' import posProcess from '@/utils/ADempiere/constants/posProcess' @@ -377,6 +341,9 @@ export default { return 24 / size } }, + created() { + this.findProcess() + }, methods: { notSubmitForm(event) { event.preventDefault() @@ -455,34 +422,31 @@ export default { }) }, reverseSalesTransaction() { - 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' - } - ] - }) + const process = this.$store.getters.getProcess(posProcess[0].uuid) + this.showModal(process) + const parametersList = [ + { + columnName: 'C_Order_ID', + value: this.$store.getters.getOrder.id + }, + { + columnName: 'Bill_BPartner_ID', + value: this.$store.getters.getOrder.businessPartner.id + }, + { + columnName: 'IsCancelled', + value: false + }, + { + columnName: 'IsShipConfirm', + value: true + }, + { + columnName: 'C_DocTypeRMA_ID', + value: 'VO' + } + ] + this.$store.dispatch('addParametersProcessPos', parametersList) }, createWithdrawal() { const { uuid: posUuid, id: posId } = this.getCurrentPOS @@ -507,13 +471,50 @@ export default { }) }, copyOrder() { - this.processPos = posProcess[5].uuid - const process = this.$store.getters.getProcess(posProcess[5].uuid) - this.showModal(process) + this.processPos = posProcess[1].uuid + const posUuid = this.currentPoint.uuid + const parametersList = [{ + columnName: 'C_Order_ID', + value: this.$store.getters.getOrder.id + }] + this.$store.dispatch('addParametersProcessPos', parametersList) + requestCreateOrder({ + posUuid, + customerUuid: this.currentPOS.businessPartner.uuid, + salesRepresentativeUuid: this.currentPOS.salesRepresentative.uuid + }) + .then(order => { + this.$store.dispatch('currentOrder', order) + + this.$router.push({ + params: { + ...this.$route.params + }, + query: { + ...this.$route.query, + action: order.uuid + } + }).then(() => { + }).catch(() => {}) + + this.$store.commit('setIsReloadListOrders') + }) + .catch(error => { + console.error(error.message) + this.$message({ + type: 'error', + message: error.message, + showClose: true + }) + }) + .finally(() => { + const process = this.$store.getters.getProcess(posProcess[1].uuid) + this.showModal(process) + }) }, copyLineOrder() { - this.processPos = posProcess[5].uuid - const process = this.$store.getters.getProcess(posProcess[5].uuid) + this.processPos = posProcess[1].uuid + const process = this.$store.getters.getProcess(posProcess[1].uuid) this.showModal(process) }, cashClosing() { @@ -524,6 +525,7 @@ export default { }) }, deleteOrder() { + this.$store.dispatch('updateOrderPos', true) requestDeleteOrder({ orderUuid: this.$route.query.action }) @@ -536,10 +538,24 @@ export default { }) this.$message({ type: 'success', - message: 'Orden Cancelada', + message: this.$t('form.pos.optionsPoinSales.salesOrder.orderRemoved'), showClose: true }) + this.$store.dispatch('updateOrderPos', false) }) + }, + seeOrderList() { + if (this.$store.getters.getListOrder.recordCount <= 0) { + this.$store.dispatch('listOrdersFromServer', {}) + } + }, + findProcess() { + const findServer = this.$store.getters.getProcess('a42ad0c6-fb40-11e8-a479-7a0060f0aa01') + if (this.isEmptyValue(findServer)) { + posProcess.forEach(item => { + this.$store.dispatch('getProcessFromServer', { containerUuid: item.uuid, processId: item.id }) + }) + } } } } diff --git a/src/components/ADempiere/Form/VPOS/OrderList/index.vue b/src/components/ADempiere/Form/VPOS/OrderList/index.vue index 97a51fa9..de46884d 100644 --- a/src/components/ADempiere/Form/VPOS/OrderList/index.vue +++ b/src/components/ADempiere/Form/VPOS/OrderList/index.vue @@ -45,8 +45,7 @@ :highlight-current-row="highlightRow" :height="heightTable" @shortkey.native="keyAction" - @current-change="orderPrpcess" - @row-dblclick="handleCurrentChange" + @current-change="handleCurrentChange" > { - this.$store.dispatch('getProcessFromServer', { containerUuid: item.uuid }) - }) } } } diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index 9ab1b1b6..5abafa44 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -347,7 +347,7 @@ export default { createPos: 'Create Point of Sale Withdrawal', print: 'Print Document', cancelOrder: 'Cancel Order', - copyOrderLine: 'Copy Order Lines', + orderRemoved: 'Order Deleted', copyOrder: 'Copy Order' }, cashManagement: { diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index f9cdac55..bbeb726a 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -322,7 +322,7 @@ export default { createPos: 'Crear Retiro de Punto de Venta', print: 'Imprimir Documento', cancelOrder: 'Cancelar Orden', - copyOrderLine: 'Copiar Lineas de la Orden', + orderRemoved: 'Orden Borrada', copyOrder: 'Copiar Orden' }, cashManagement: { diff --git a/src/store/modules/ADempiere/process/actions.js b/src/store/modules/ADempiere/process/actions.js index ee9cb3a9..bbf93284 100644 --- a/src/store/modules/ADempiere/process/actions.js +++ b/src/store/modules/ADempiere/process/actions.js @@ -1172,8 +1172,9 @@ export default { type: 'info' }) } + dispatch('updateOrderPos', true) const timeInitialized = (new Date()).getTime() - let processResult = { + const processResult = { // panel attributes from where it was executed parentUuid, containerUuid, @@ -1193,35 +1194,20 @@ export default { output: '', outputStream: '', reportType: '' - } - } - if (!isEmptyValue(isActionDocument)) { - processResult = { - ...processResult, - processUuid: action.uuid, - processId: action.id, - processName: 'Procesar Orden', - parameters: parametersList - } - } else { - // Run process on server and wait for it for notify - // uuid of process - processResult = { - ...processResult, - menuParentUuid, - processIdPath: isEmptyValue(routeToDelete) ? '' : routeToDelete.path, - printFormatUuid: action.printFormatUuid, - // process attributes - action: processDefinition.name, - name: processDefinition.name, - description: processDefinition.description, - instanceUuid: '', - processUuid: processDefinition.uuid, - processId: processDefinition.id, - processName: processDefinition.processName, - parameters: parametersList, - isReport: processDefinition.isReport - } + }, + menuParentUuid, + processIdPath: isEmptyValue(routeToDelete) ? '' : routeToDelete.path, + printFormatUuid: action.printFormatUuid, + // process attributes + action: processDefinition.name, + name: processDefinition.name, + description: processDefinition.description, + instanceUuid: '', + processUuid: processDefinition.uuid, + processId: processDefinition.id, + processName: processDefinition.processName, + parameters: parametersList, + isReport: processDefinition.isReport } commit('addInExecution', processResult) requestRunProcess({ @@ -1282,7 +1268,7 @@ export default { dispatch('setProcessSelect', { finish: true }) - dispatch('updateOrderPos', true) + dispatch('updateOrderPos', false) }) }) } diff --git a/src/utils/ADempiere/constants/posProcess.js b/src/utils/ADempiere/constants/posProcess.js index 8b0ac92c..bc46e7ea 100644 --- a/src/utils/ADempiere/constants/posProcess.js +++ b/src/utils/ADempiere/constants/posProcess.js @@ -1,27 +1,33 @@ const posProcess = [ - { - name: 'C_POS Generate Immediate Invoice', - uuid: 'a42cce58-fb40-11e8-a479-7a0060f0aa01' - }, + // { + // name: 'C_POS Generate Immediate Invoice', + // uuid: 'a42cce58-fb40-11e8-a479-7a0060f0aa01', + // id: 53823 + // }, { name: 'C_POS ReverseTheSalesTransaction', - uuid: 'a42ccebc-fb40-11e8-a479-7a0060f0aa01' - }, - { - name: 'C_POS CreateOrderBasedOnAnother', - uuid: 'a42ccc46-fb40-11e8-a479-7a0060f0aa01' - }, - { - name: 'C_POS Withdrawal', - uuid: 'a42ce0a0-fb40-11e8-a479-7a0060f0aa01' - }, - { - name: 'C_POS Bank Statement Close', - uuid: 'a42ce118-fb40-11e8-a479-7a0060f0aa01' + uuid: 'a42ccebc-fb40-11e8-a479-7a0060f0aa01', + id: 53824 }, + // { + // name: 'C_POS CreateOrderBasedOnAnother', + // uuid: 'a42ccc46-fb40-11e8-a479-7a0060f0aa01', + // id: 53822 + // }, + // { + // name: 'C_POS Withdrawal', + // uuid: 'a42ce0a0-fb40-11e8-a479-7a0060f0aa01', + // id: 53846 + // }, + // { + // name: 'C_POS Bank Statement Close', + // uuid: 'a42ce118-fb40-11e8-a479-7a0060f0aa01', + // id: 53847 + // }, { name: 'C_Order CopyFrom', - uuid: 'a42ad0c6-fb40-11e8-a479-7a0060f0aa01' + uuid: 'a42ad0c6-fb40-11e8-a479-7a0060f0aa01', + id: 211 } ] export default posProcess