Index: src/stock-adjustment-mobile/add-products-page/add-product-page.jsx =================================================================== diff -u -N -r63e7c1be5862dfb93ab40ede249237b50d2c08f4 -r9cd9fddd897288549e91a306f9b33e8a51d54be9 --- src/stock-adjustment-mobile/add-products-page/add-product-page.jsx (.../add-product-page.jsx) (revision 63e7c1be5862dfb93ab40ede249237b50d2c08f4) +++ src/stock-adjustment-mobile/add-products-page/add-product-page.jsx (.../add-product-page.jsx) (revision 9cd9fddd897288549e91a306f9b33e8a51d54be9) @@ -74,8 +74,10 @@ const errors = { items: [] }; values.items.forEach(item => { + let orderable = item.product; if (!item.product) { errors.items['product'] = { product: 'Required' }; + orderable = []; } if (isQuantityNotFilled(item.quantity)) { @@ -84,6 +86,13 @@ if (!item.reason) { errors.items['reason'] = { reason: 'Required' }; + } else { + const stockOnHandQuantity = getStockOnHand(orderable, item?.lot?.lotCode ?? null); + if (!errors.items.hasOwnProperty('quantity')) { + if (item.reason.reasonType !== "CREDIT" && item.quantity > stockOnHandQuantity) { + errors.items['quantity'] = { quantity: 'Quantity cannot be greater than stock on hand value.' }; + } + } } });