From 60508a97061ad910d7c9324ee1da7be64d326884 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:06:20 +0530 Subject: [PATCH] fix: 'NoneType' object has no attribute 'has_serial_no' (backport #43514) (#43574) fix: 'NoneType' object has no attribute 'has_serial_no' (#43514) (cherry picked from commit 6ddda6c949c582cd6f991637620f7082878f0495) Co-authored-by: rohitwaghchaure --- 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 9fb0cc88cfb..537b37facf4 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: