Skip to content

No duplicate check for Serial No #49520

@nikolas-beckel

Description

@nikolas-beckel

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

Relevant log output / Stack trace / Full Error Message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions