From 6ddda6c949c582cd6f991637620f7082878f0495 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 8 Oct 2024 17:41:09 +0530 Subject: [PATCH] fix: 'NoneType' object has no attribute 'has_serial_no' (#43514) --- erpnext/controllers/stock_controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index dbcf1a3e7f2..0f299492c6a 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -357,6 +357,9 @@ class StockController(AccountsController): @frappe.request_cache def is_serial_batch_item(self, item_code) -> bool: + if not frappe.db.exists("Item", item_code): + frappe.throw(_("Item {0} does not exist.").format(bold(item_code))) + item_details = frappe.db.get_value("Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1) if item_details.has_serial_no or item_details.has_batch_no: