diff --git a/src/api/ADempiere/form/point-of-sales.js b/src/api/ADempiere/form/point-of-sales.js index e463903833..618b011382 100644 --- a/src/api/ADempiere/form/point-of-sales.js +++ b/src/api/ADempiere/form/point-of-sales.js @@ -643,10 +643,10 @@ export function validatePin({ } /** - * list Warehouse + * list Warehouses * @param {string} posUuidd - POS UUID reference */ -export function listWarehouse({ +export function listWarehouses({ posUuid }) { return request({ @@ -661,6 +661,25 @@ export function listWarehouse({ }) } +/** + * list Document Types + * @param {string} posUuidd - POS UUID reference + */ +export function listDocumentTypes({ + posUuid +}) { + return request({ + url: `${config.pointOfSales.endpoint}/available-document-types`, + method: 'get', + params: { + pos_uuid: posUuid + } + }) + .then(response => { + return response + }) +} + /** * List Prices * @param {string} posUuidd - POS UUID reference diff --git a/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js b/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js index e99224328c..0b30842424 100644 --- a/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js +++ b/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js @@ -27,86 +27,5 @@ export default [ handleActionPerformed: true, handleActionKeyPerformed: true } - }, - { - elementColumnName: 'C_DocType_ID', - tabindex: '2', - isFromDictionary: true, - overwriteDefinition: { - size: 24, - handleActionPerformed: true, - handleContentSelection: true, - handleActionKeyPerformed: true - } - }, - { - elementColumnName: 'C_DocTypeTarget_ID', - tabindex: '2', - isFromDictionary: true, - overwriteDefinition: { - size: 24, - handleFocusGained: true, - handleActionPerformed: true, - handleContentSelection: true, - handleActionKeyPerformed: true, - isReadOnly: true - } } - // { - // elementColumnName: 'PriceEntered', - // columnName: 'PriceEntered', - // tabindex: '3', - // isFromDictionary: true, - // overwriteDefinition: { - // size: 24, - // sequence: 9, - // isReadOnly: true, - // handleActionPerformed: true, - // handleContentSelection: true, - // handleActionKeyPerformed: true - // } - // }, - // { - // elementColumnName: 'Discount', - // columnName: 'Discount', - // tabindex: '4', - // isFromDictionary: true, - // overwriteDefinition: { - // size: 24, - // sequence: 10, - // isReadOnly: true, - // handleActionPerformed: true, - // handleContentSelection: true, - // handleActionKeyPerformed: true - // } - // }, - // { - // tableName: 'C_Order', - // columnName: 'C_Currency_ID', - // isFromDictionary: true, - // overwriteDefinition: { - // size: 24, - // handleActionKeyPerformed: true, - // handleActionPerformed: true, - // validationCode: 'C_Currency.C_Currency_ID = 100', - // isActiveLogics: false, - // isMandatory: true - // } - // } - // // TenderType - // { - // tableName: 'C_Payment', - // elementColumnName: 'TenderType', - // columnName: 'TenderType', - // isFromDictionary: true, - // overwriteDefinition: { - // defaultValue: 'X', - // handleActionKeyPerformed: true, - // handleContentSelection: true, - // handleActionPerformed: true, - // size: 24, - // isActiveLogics: false, - // isMandatory: true - // } - // } ] diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index 83cf47117b..c83a353b35 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -54,11 +54,28 @@ - +
+ + + + {{ currentDocumentType.name }} + + + + {{ item.name }} + + + +
@@ -262,7 +279,7 @@ @@ -573,7 +590,6 @@ export default { currentOrder() { if (this.isEmptyValue(this.currentPointOfSales)) { return { - documentType: {}, documentStatus: { value: '' }, @@ -619,15 +635,27 @@ export default { }, currentWarehouse() { if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) { - return this.$store.getters.getcurrentWarehousePos + return this.$store.getters.getCurrentWarehousePos + } + return {} + }, + currentDocumentType() { + if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.documentType)) { + return this.$store.getters.getCurrentDocumentTypePos } return {} }, - listWarehouse() { + listWarehouses() { if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehousesList)) { return this.$store.getters.posAttributes.currentPointOfSales.warehousesList } return [] + }, + listDocumentTypes() { + if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.documentTypesList)) { + return this.$store.getters.posAttributes.currentPointOfSales.documentTypesList + } + return [] } }, watch: { @@ -768,6 +796,14 @@ export default { } this.visible = true }, + changeDocumentType(documentType) { + this.attributePin = { + ...documentType, + action: 'changeDocumentType', + type: 'actionPos' + } + this.visible = true + }, changePriceList(priceList) { this.attributePin = { ...priceList, diff --git a/src/components/ADempiere/Form/VPOS/posMixin.js b/src/components/ADempiere/Form/VPOS/posMixin.js index a9617d2136..29d5f9a823 100644 --- a/src/components/ADempiere/Form/VPOS/posMixin.js +++ b/src/components/ADempiere/Form/VPOS/posMixin.js @@ -245,6 +245,9 @@ export default { case 'changeWarehouse': this.$store.commit('setCurrentWarehousePos', action) break + case 'changeDocumentType': + this.$store.commit('setCurrentDocumentTypePos', action) + break case 'changePriceList': this.$store.commit('setCurrentPriceList', action) break diff --git a/src/store/modules/ADempiere/pointOfSales/getters/index.js b/src/store/modules/ADempiere/pointOfSales/getters/index.js index a49b7b7ac2..3c57a7026b 100644 --- a/src/store/modules/ADempiere/pointOfSales/getters/index.js +++ b/src/store/modules/ADempiere/pointOfSales/getters/index.js @@ -55,6 +55,7 @@ export default { ...state.currentPointOfSales, listOrder: state.listOrder, warehousesList: state.warehousesList, + documentTypesList: state.documentTypesList, pricesList: state.pricesList, currentPriceList: state.currentPriceList, currentOrder: { @@ -124,11 +125,21 @@ export default { /** * Current Warehouse */ - getcurrentWarehousePos: (state) => { + getCurrentWarehousePos: (state) => { if (!isEmptyValue(state.currentWarehousePos)) { return state.currentWarehousePos } return {} + }, + + /** + * Current Document Type + */ + getCurrentDocumentTypePos: (state) => { + if (!isEmptyValue(state.currentDocumentTypePos)) { + return state.currentDocumentTypePos + } + return {} } // Current POS, it can be s } diff --git a/src/store/modules/ADempiere/pointOfSales/point/actions.js b/src/store/modules/ADempiere/pointOfSales/point/actions.js index 7ee595b5e5..1d64bf8d4b 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/actions.js +++ b/src/store/modules/ADempiere/pointOfSales/point/actions.js @@ -17,7 +17,8 @@ import router from '@/router' import { listPointOfSales, - listWarehouse, + listWarehouses, + listDocumentTypes, listPrices, listCurrencies } from '@/api/ADempiere/form/point-of-sales.js' @@ -61,15 +62,31 @@ export default { }) }) }, - listWarehouseFromServer({ commit }, posUuid) { - listWarehouse({ + listWarehousesFromServer({ commit }, posUuid) { + listWarehouses({ posUuid }) .then(response => { commit('setWarehousesList', response.records) }) .catch(error => { - console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`) + console.warn(`listWarehousesFromServer: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }, + listDocumentTypesFromServer({ commit }, posUuid) { + listDocumentTypes({ + posUuid + }) + .then(response => { + commit('setDocumentTypesList', response.records) + }) + .catch(error => { + console.warn(`listDocumentTypesFromServer: ${error.message}. Code: ${error.code}.`) showMessage({ type: 'error', message: error.message, @@ -123,10 +140,12 @@ export default { } }, () => {}) state.currenciesList = [] - dispatch('listWarehouseFromServer', posToSet.uuid) + dispatch('listWarehousesFromServer', posToSet.uuid) + dispatch('listDocumentTypesFromServer', posToSet.uuid) dispatch('listCurrenciesFromServer', posToSet.uuid) dispatch('listPricesFromServer', posToSet) commit('setCurrentPriceList', posToSet.priceList) + commit('setCurrentDocumentTypePos', posToSet.documentType) commit('setCurrentWarehousePos', rootGetters['user/getWarehouse']) commit('resetConversionRate', []) commit('setIsReloadKeyLayout') diff --git a/src/store/modules/ADempiere/pointOfSales/point/mutations.js b/src/store/modules/ADempiere/pointOfSales/point/mutations.js index 2ad6fe00c2..3750c26ed4 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/mutations.js +++ b/src/store/modules/ADempiere/pointOfSales/point/mutations.js @@ -25,12 +25,18 @@ export default { setWarehousesList(state, warehousesList) { state.warehousesList = warehousesList }, + setDocumentTypesList(state, documentTypesList) { + state.documentTypesList = documentTypesList + }, setCurrentPriceList(state, currentPriceList) { state.currentPriceList = currentPriceList }, setCurrentWarehousePos(state, warehouse) { state.currentWarehousePos = warehouse }, + setCurrentDocumentTypePos(state, documentType) { + state.currentDocumentTypePos = documentType + }, setPricesList(state, pricesList) { state.pricesList = pricesList }, diff --git a/src/store/modules/ADempiere/pointOfSales/point/state.js b/src/store/modules/ADempiere/pointOfSales/point/state.js index 99fa328200..cae9bc8a5a 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/state.js +++ b/src/store/modules/ADempiere/pointOfSales/point/state.js @@ -29,9 +29,11 @@ export default { }, pointOfSalesList: {}, warehousesList: {}, + documentTypesList: {}, pricesList: {}, currentPriceList: {}, currentWarehousePos: {}, + currentDocumentTypePos: {}, listCurrency: [], conversionsList: [], currentPointOfSales: {},