From 8d6582b991db999325853045e00e8a7042feb565 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 19 Mar 2024 14:24:32 +0530 Subject: [PATCH] fix: stock reco negative batch --- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 7 +++++++ .../doctype/stock_reconciliation/stock_reconciliation.py | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 9a7395fc6674..a27497d9197e 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -828,6 +828,13 @@ def validate_batch_inventory(self): if not self.has_batch_no: return + if ( + self.voucher_type == "Stock Reconciliation" + and self.type_of_transaction == "Outward" + and frappe.db.get_value("Stock Reconciliation Item", self.voucher_detail_no, "qty") > 0 + ): + return + batches = [d.batch_no for d in self.entries if d.batch_no] if not batches: return diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 3356ad5f3009..0311481b6cad 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -154,7 +154,6 @@ def make_bundle_for_current_qty(self): { "current_serial_and_batch_bundle": sn_doc.name, "current_serial_no": "", - "batch_no": "", } )