From e8882718c9d99db01f3dbc16c477c4e295b9becb Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 12 Nov 2024 17:41:55 +0530 Subject: [PATCH] fix: not able to cancel DN (#44108) --- erpnext/stock/serial_batch_bundle.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index cb156aea119..3fed0195d69 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -288,7 +288,7 @@ class SerialBatchBundle: "Serial and Batch Bundle", self.sle.serial_and_batch_bundle, "docstatus" ) - if docstatus != 1: + if docstatus == 0: self.submit_serial_and_batch_bundle() if self.item_details.has_serial_no == 1: @@ -311,7 +311,9 @@ class SerialBatchBundle: if self.is_pos_transaction(): return - frappe.get_cached_doc("Serial and Batch Bundle", self.sle.serial_and_batch_bundle).cancel() + doc = frappe.get_cached_doc("Serial and Batch Bundle", self.sle.serial_and_batch_bundle) + if doc.docstatus == 1: + doc.cancel() def is_pos_transaction(self): if (