When using Stock Reconciliation for an item that is both Batch-tracked and Serial Number-tracked, the system incorrectly validates serial numbers if the item exists in multiple batches.
Steps to Reproduce
-
Create an item that has both Has Batch No and Has Serial No enabled.
-
Assume:
-
Batch 1 contains 10 serial numbers.
-
Batch 2 contains 3 serial numbers.
-
-
Create a Stock Reconciliation document.
-
Update the quantity for Batch 2 from 3 to 1.
-
When creating/submitting the document, select the single serial number that should remain in Batch 2.
Actual Behavior
The system fetches serial numbers from all batches instead of only the selected batch.
As a result, validation fails because it compares the selected serial numbers against the total number of serial numbers across all batches, producing an incorrect validation error.
Expected Behavior
When reconciling a specific batch, serial number validation should be limited to the serial numbers belonging to that batch only. Serial numbers from other batches should not be included in the validation.
Additional Information
-
This issue occurs only when the item exists in multiple batches.
-
If the item has only one batch, the Stock Reconciliation works correctly and no validation error is raised.