diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index 4666c953fbe..36341a090dc 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -637,7 +637,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 f5dd1c4f16c..99a6abc8b91 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -195,6 +195,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):