Merge pull request #22179 from rohitwaghchaure/code-cleanup-for-handling-batch-case-in-SI-develop
fix: Cannot read property 'has_batch_no' of undefined
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 9421668..ca897dd 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -552,7 +552,8 @@
if (show_batch_dialog)
return frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
.then((r) => {
- if(r.message.has_batch_no || r.message.has_serial_no) {
+ if (r.message &&
+ (r.message.has_batch_no || r.message.has_serial_no)) {
frappe.flags.hide_serial_batch_dialog = false;
}
});