From a3d4d344542c70ce62cffcee7dd0315d11d03bd2 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 9 Apr 2025 17:14:40 +0530 Subject: [PATCH] fix: serial no validation for stock reconciliation --- erpnext/stock/doctype/serial_no/serial_no.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 9dfd12acc2c..654f28e661c 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -279,7 +279,14 @@ def validate_serial_no(sle, item_det): _("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty) ) - if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)): + if ( + ( + (sle.voucher_type == "Stock Reconciliation" and sle.actual_qty > 0) + or sle.voucher_type != "Stock Reconciliation" + ) + and len(serial_nos) + and len(serial_nos) != abs(cint(sle.actual_qty)) + ): frappe.throw( _("{0} Serial Numbers required for Item {1}. You have provided {2}.").format( abs(sle.actual_qty), sle.item_code, len(serial_nos)