From 3ca19408811bbf26819c6ba65fc9522a8c80aa4a Mon Sep 17 00:00:00 2001 From: Kavin <78342682+kavin0411@users.noreply.github.com> Date: Wed, 12 Nov 2025 11:32:41 +0530 Subject: [PATCH] fix: validate sabb autocreation when disabled --- erpnext/stock/doctype/stock_entry/stock_entry.py | 4 +++- erpnext/stock/serial_batch_bundle.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 932f8a4844e..8daefa20bc3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1213,7 +1213,9 @@ class StockEntry(StockController, SubcontractingInwardController): ).update_serial_and_batch_entries( serial_nos=serial_nos.get(row.name), batch_nos=batch_nos.get(row.name) ) - elif not row.serial_and_batch_bundle: + elif not row.serial_and_batch_bundle and frappe.get_single_value( + "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward" + ): bundle_doc = SerialBatchCreation( { "item_code": row.item_code, diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index e7cbc8bceed..1d8abe31a7b 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -268,7 +268,7 @@ class SerialBatchBundle: and not self.sle.serial_and_batch_bundle and self.item_details.has_batch_no == 1 and ( - self.item_details.create_new_batch + (self.item_details.create_new_batch and self.sle.actual_qty > 0) or ( frappe.get_single_value( "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward"