diff --git a/src/api/ADempiere/fields/search/product.ts b/src/api/ADempiere/fields/search/product.ts index 22fba58d7cf..ea23d2ef26b 100644 --- a/src/api/ADempiere/fields/search/product.ts +++ b/src/api/ADempiere/fields/search/product.ts @@ -278,6 +278,7 @@ export function requestListProducts({ upc, sku, is_stocked, + is_only_stock_available, product_group_id, product_class_id, product_category_id, @@ -335,6 +336,7 @@ export function requestListProducts({ sku, upc, is_stocked, + is_only_stock_available, product_group_id, product_class_id, product_category_id, diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isOnlyOnHandField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isOnlyOnHandField.vue new file mode 100644 index 00000000000..cd607ab223e --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isOnlyOnHandField.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isStockedField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isStockedField.vue index 5d4b0fddf29..6fb4460b927 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isStockedField.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isStockedField.vue @@ -43,12 +43,16 @@ import store from '@/store' // Constants import { YES_NO_OPTIONS_LIST } from '@/utils/ADempiere/dictionary/field/yesNo' -// Utils and Helper Methods -import { isEmptyValue } from '@/utils/ADempiere/valueUtils' +// Components and Mixins +import EmptyOptionSelect from '@/components/ADempiere/FieldDefinition/FieldSelect/emptyOptionSelect.vue' export default defineComponent({ name: 'IsStokedField', + components: { + EmptyOptionSelect + }, + props: { uuidForm: { required: true, @@ -69,7 +73,6 @@ export default defineComponent({ const currentValue = computed({ set(newValue) { - if (isEmptyValue(newValue)) newValue = -1 store.commit('setProductSearchFieldQueryFilterByAttribute', { containerUuid: props.uuidForm, attributeKey: ATTRIBUTE_KEY, diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/warehouseField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/warehouseField.vue index c13a5a2a018..fa688c7e51c 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/warehouseField.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/warehouseField.vue @@ -49,6 +49,7 @@ import store from '@/store' // Components and Mixins import EmptyOptionSelect from '@/components/ADempiere/FieldDefinition/FieldSelect/emptyOptionSelect.vue' + // Utils and Helper Methods import { isEmptyValue } from '@/utils/ADempiere/valueUtils' @@ -83,7 +84,15 @@ export default defineComponent({ const currentValue = computed({ set(newValue) { - if (isEmptyValue(newValue)) newValue = -1 + if (isEmptyValue(newValue)) { + newValue = -1 + + store.commit('setProductSearchFieldQueryFilterByAttribute', { + containerUuid: props.uuidForm, + attributeKey: 'is_only_stock_available', + value: false + }) + } store.commit('setProductSearchFieldQueryFilterByAttribute', { containerUuid: props.uuidForm, attributeKey: ATTRIBUTE_KEY, diff --git a/src/components/ADempiere/Form/ProductSearch/index.vue b/src/components/ADempiere/Form/ProductSearch/index.vue index 4bb16fdc312..87c1265e595 100644 --- a/src/components/ADempiere/Form/ProductSearch/index.vue +++ b/src/components/ADempiere/Form/ProductSearch/index.vue @@ -333,7 +333,14 @@ export default defineComponent({ }) }) - const isStockQuantities = computed(() => { + const getIsOnlyStockAvailable = computed(() => { + return store.getters.getProductSearchFieldQueryFilterByAttribute({ + containerUuid: uuidForm, + attributeKey: 'is_only_stock_available' + }) + }) + + const getWarehouseId = computed(() => { return store.getters.getProductSearchFieldQueryFilterByAttribute({ containerUuid: uuidForm, attributeKey: 'warehouse_id' @@ -567,7 +574,13 @@ export default defineComponent({ } }) - watch(isStockQuantities, (newValue, oldValue) => { + watch(getIsOnlyStockAvailable, (newValue, oldValue) => { + if (newValue !== oldValue) { + searchProduct() + } + }) + + watch(getWarehouseId, (newValue, oldValue) => { if (newValue !== oldValue) { searchProduct() } @@ -603,8 +616,9 @@ export default defineComponent({ listProducto, recordCount, getIsStocked, + getIsOnlyStockAvailable, getVendorId, - isStockQuantities, + getWarehouseId, getPriceListVersion, getProductCategoryField, getProductClassField, diff --git a/src/components/ADempiere/Form/ProductSearch/queryCriteria.vue b/src/components/ADempiere/Form/ProductSearch/queryCriteria.vue index 923f83513d6..c30763b6baa 100644 --- a/src/components/ADempiere/Form/ProductSearch/queryCriteria.vue +++ b/src/components/ADempiere/Form/ProductSearch/queryCriteria.vue @@ -43,11 +43,16 @@ :uuid-form="uuidForm" /> - + + + + import { defineComponent, ref, computed } from '@vue/composition-api' + import store from '@/store' + // Components and Mixins import VendorField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/vendorField.vue' import WarehouseField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/warehouseField.vue' import IsStockedField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isStockedField.vue' +import IsOnlyOnHandField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/isOnlyOnHandField.vue' import PriceListVersionField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/priceListVersionField.vue' import ProductCategoryField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/productCategoryField.vue' import ProductClassField from '@/components/ADempiere/FieldDefinition/FieldSearch/ProductInfo/PanelForm/QueryCriteria/productClassField.vue' @@ -102,6 +110,7 @@ export default defineComponent({ VendorField, WarehouseField, IsStockedField, + IsOnlyOnHandField, ProductClassField, ProductGroupField, ProductCategoryField, diff --git a/src/lang/ADempiere/en/field/product.ts b/src/lang/ADempiere/en/field/product.ts index 2c3c19ed8b3..29364b95571 100644 --- a/src/lang/ADempiere/en/field/product.ts +++ b/src/lang/ADempiere/en/field/product.ts @@ -46,6 +46,7 @@ const product = { margin: 'Margin', // quantity stocked: 'Stocked', + onlyOnHand: 'Only On Hand', available: 'Available', onHandQuantity: 'On Hand Qty', reservedQuantity: 'Reserved Qty', diff --git a/src/lang/ADempiere/es/field/product.ts b/src/lang/ADempiere/es/field/product.ts index f000ea50399..8db47987881 100644 --- a/src/lang/ADempiere/es/field/product.ts +++ b/src/lang/ADempiere/es/field/product.ts @@ -46,6 +46,7 @@ const product = { margin: 'Margen', // quantity stocked: 'Almacenado', + onlyOnHand: 'Solo Disponible', available: 'Cant. Disponible', onHandQuantity: 'Cant. Existencia', reservedQuantity: 'Cant. Reservada', diff --git a/src/store/modules/ADempiere/field/search/productFieldSearch.js b/src/store/modules/ADempiere/field/search/productFieldSearch.js index 1c8587f7979..376983e9e40 100644 --- a/src/store/modules/ADempiere/field/search/productFieldSearch.js +++ b/src/store/modules/ADempiere/field/search/productFieldSearch.js @@ -44,6 +44,7 @@ const emptyQueryFilters = { price_list_version_id: undefined, warehouse_id: undefined, is_stocked: undefined, + is_only_stock_available: false, attribute_set_id: undefined, attribute_set_instance_id: undefined, vendor_id: undefined,