From 85c0c1696430d75af4f6d2c9cd527e96a699335c 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 1/3] fix: validate sabb autocreation when disabled (cherry picked from commit 3ca19408811bbf26819c6ba65fc9522a8c80aa4a) # Conflicts: # erpnext/stock/doctype/stock_entry/stock_entry.py --- erpnext/stock/doctype/stock_entry/stock_entry.py | 9 +++++++++ erpnext/stock/serial_batch_bundle.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 76c57ae873d..8d72aae7506 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1135,8 +1135,17 @@ class StockEntry(StockController): "ignore_serial_nos": already_picked_serial_nos, "qty": row.transfer_qty * -1, } +<<<<<<< HEAD ).update_serial_and_batch_entries() elif not row.serial_and_batch_bundle: +======= + ).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 and frappe.get_single_value( + "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward" + ): +>>>>>>> 3ca1940881 (fix: validate sabb autocreation when disabled) 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 db9cf422b5f..2ee85fc2c24 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -259,7 +259,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.db.get_single_value( "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward" From 36e9aae9d05770598ecb839b259a94e1fcad04d0 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 18 Nov 2025 18:04:29 +0530 Subject: [PATCH 2/3] chore: fix conflicts --- erpnext/stock/doctype/stock_entry/stock_entry.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 8d72aae7506..0ead7461d67 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1135,17 +1135,9 @@ class StockEntry(StockController): "ignore_serial_nos": already_picked_serial_nos, "qty": row.transfer_qty * -1, } -<<<<<<< HEAD - ).update_serial_and_batch_entries() - elif not row.serial_and_batch_bundle: -======= - ).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 and frappe.get_single_value( "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward" ): ->>>>>>> 3ca1940881 (fix: validate sabb autocreation when disabled) bundle_doc = SerialBatchCreation( { "item_code": row.item_code, From 876dec5077217788df16c0cc109b110e6bc8b809 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 18 Nov 2025 18:05:08 +0530 Subject: [PATCH 3/3] chore: fix conflicts --- erpnext/stock/doctype/stock_entry/stock_entry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 0ead7461d67..9664ed67498 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1135,6 +1135,7 @@ class StockEntry(StockController): "ignore_serial_nos": already_picked_serial_nos, "qty": row.transfer_qty * -1, } + ).update_serial_and_batch_entries() elif not row.serial_and_batch_bundle and frappe.get_single_value( "Stock Settings", "auto_create_serial_and_batch_bundle_for_outward" ):