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.
This commit is contained in:
Mihir Kandoi
2026-08-11 12:16:46 +05:30
parent 2d022ffb66
commit 26a05044c0

View File

@@ -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(