From ec1636db12579e6d4de38c4a404ed2b6af37f78a Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sun, 12 Oct 2025 13:10:39 +0530 Subject: [PATCH] fix: reset raw materials considering not available batches --- erpnext/controllers/subcontracting_controller.py | 3 ++- .../doctype/subcontracting_receipt/subcontracting_receipt.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index db42d11ab0a..8a94e3c057f 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -643,7 +643,8 @@ class SubcontractingController(StockController): if use_serial_batch_fields: rm_obj.use_serial_batch_fields = 1 - self.__set_batch_nos(bom_item, item_row, rm_obj, qty) + if not self.flags.get("reset_raw_materials"): + self.__set_batch_nos(bom_item, item_row, rm_obj, qty) if self.doctype == "Subcontracting Receipt": if not use_serial_batch_fields: diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index e7555194672..72d434eea55 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -198,6 +198,7 @@ class SubcontractingReceipt(SubcontractingController): @frappe.whitelist() def reset_raw_materials(self): self.supplied_items = [] + self.flags.reset_raw_materials = True self.create_raw_materials_supplied() def validate_closed_subcontracting_order(self):