From c20241fcb5d7269c08c38f51c92bf73289650708 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Fri, 12 Jan 2024 15:26:35 +0530 Subject: [PATCH] fix: SBB Total Qty validation for SE --- erpnext/controllers/stock_controller.py | 6 +----- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 671d2fb7a5..de86846701 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -395,11 +395,7 @@ class StockController(AccountsController): } for row in self.get(table_name): - for field in [ - "serial_and_batch_bundle", - "current_serial_and_batch_bundle", - "rejected_serial_and_batch_bundle", - ]: + for field in QTY_FIELD.keys(): if row.get(field): frappe.get_doc("Serial and Batch Bundle", row.get(field)).set_serial_and_batch_values( self, row, qty_field=QTY_FIELD[field] 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 620b9606a7..2b87fcd175 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 @@ -490,8 +490,10 @@ class SerialandBatchBundle(Document): qty_field = "qty" precision = row.precision - if row.get("doctype") in ["Subcontracting Receipt Supplied Item"]: + if row.get("doctype") == "Subcontracting Receipt Supplied Item": qty_field = "consumed_qty" + elif row.get("doctype") == "Stock Entry Detail": + qty_field = "transfer_qty" qty = row.get(qty_field) if qty_field == "qty" and row.get("stock_qty"):