From 8c85012a70d19468b1977ef6e0708af3809d2ec5 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 11 Nov 2021 14:46:19 +0530 Subject: [PATCH] fix: can not cancel stock reconciliation with sr no --- erpnext/stock/doctype/serial_no/serial_no.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index d9d1957c0b..38291d19ec 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -342,7 +342,7 @@ def check_serial_no_validity_on_cancel(serial_no, sle): is_stock_reco = sle.voucher_type == "Stock Reconciliation" msg = None - if sr and (actual_qty < 0 or is_stock_reco) and sr.warehouse != sle.warehouse: + if sr and (actual_qty < 0 or is_stock_reco) and (sr.warehouse and sr.warehouse != sle.warehouse): # receipt(inward) is being cancelled msg = _("Cannot cancel {0} {1} as Serial No {2} does not belong to the warehouse {3}").format( sle.voucher_type, doc_link, sr_link, frappe.bold(sle.warehouse))