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 6ddda6c949)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-10-09 09:06:20 +05:30
committed by GitHub
parent 660d20f7fa
commit 60508a9706

View File

@@ -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: