From 26a05044c06a38a526040390337fec348a587d3b Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 11 Aug 2026 12:16:46 +0530 Subject: [PATCH] fix: link an active non-corrective job card in the operations error Cancelled, amended, and corrective job cards do not contribute to the operation's completed qty, so the error should not direct users there. --- erpnext/stock/doctype/stock_entry/services/manufacturing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/services/manufacturing.py b/erpnext/stock/doctype/stock_entry/services/manufacturing.py index 03f843e4dfb..8bec6d8df3a 100644 --- a/erpnext/stock/doctype/stock_entry/services/manufacturing.py +++ b/erpnext/stock/doctype/stock_entry/services/manufacturing.py @@ -405,7 +405,11 @@ class ManufactureStockEntry(BaseManufactureStockEntry): self.throw_operations_not_complete_error(row, total_completed_qty) def throw_operations_not_complete_error(self, operation_row, total_completed_qty): - job_card = frappe.db.get_value("Job Card", {"operation_id": operation_row.name}, "name") + job_card = frappe.db.get_value( + "Job Card", + {"operation_id": operation_row.name, "docstatus": ("<", 2), "is_corrective_job_card": 0}, + "name", + ) if not job_card: frappe.throw( _("Work Order {0}: Job Card not found for the operation {1}").format(