fix: 'NoneType' object has no attribute 'has_serial_no' (#43514)

This commit is contained in:
rohitwaghchaure
2024-10-08 17:41:09 +05:30
committed by GitHub
parent 5130f7d411
commit 6ddda6c949

View File

@@ -357,6 +357,9 @@ class StockController(AccountsController):
@frappe.request_cache @frappe.request_cache
def is_serial_batch_item(self, item_code) -> bool: 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) 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: if item_details.has_serial_no or item_details.has_batch_no: