fix: job card for quantity UX
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js
index b6646b1..619e6bd 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.js
+++ b/erpnext/manufacturing/doctype/job_card/job_card.js
@@ -33,6 +33,11 @@
return;
}
+ let has_stock_entry = frm.doc.__onload &&
+ frm.doc.__onload.has_stock_entry ? true : false;
+
+ frm.toggle_enable("for_quantity", !has_stock_entry);
+
if (!frm.is_new() && has_items && frm.doc.docstatus < 2) {
let to_request = frm.doc.for_quantity > frm.doc.transferred_qty;
let excess_transfer_allowed = frm.doc.__onload.job_card_excess_transfer;
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py
index 8226475..3133628 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card.py
@@ -57,6 +57,10 @@
)
self.set_onload("job_card_excess_transfer", excess_transfer)
self.set_onload("work_order_closed", self.is_work_order_closed())
+ self.set_onload("has_stock_entry", self.has_stock_entry())
+
+ def has_stock_entry(self):
+ return frappe.db.exists("Stock Entry", {"job_card": self.name, "docstatus": ["!=", 2]})
def before_validate(self):
self.set_wip_warehouse()