-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Information about the bug
If a serial number has already been assigned to an item that is still in the warehouse, it is not possible to create another item with the same serial number via a stock entry of type "Manufacture".
However, if the item with the already assigned serial number has been delivered to a customer and is no longer in stock, it is possible to reuse the same serial number via a stock entry of type "Manufacture". In that case, the existing information related to the serial number - such as the customer it was sold to and the original creation document - is simply overwritten.
As a result, two different items can be created with the same serial number, while the information of the first item gets lost.
This behavior occurs only if the reused serial number is assigned to an item with the same Item Code. If an attempt is made to use the serial number with a different Item Code, the following error message is shown instead, which indicates that the check works partially as intended: Serial Nos SN-003 does not belong to Item 004.
20250910-1002-07.7883783.mp4
Impact
Allowing multiple items with the same serial number can prevent proper traceability of individual items in the system. Furthermore, no plausibility check is triggered to verify whether the serial number has already been used. This can lead to serious issues if information about older items is lost or overwritten in the system.
Affected files
Based on initial observation, the issue seems to occur in the file serial_and_batch_bundle.py within the method validate_serial_nos_duplicate, which then calls the method get_available_serial_nos. At this point, a proper check for actual duplicates does not seem to be performed.
Module
stock
Version
Frappe version - v15.81.0
ERPNext version - v15.78.1
Installation method
docker