fix: Work order dialog box 'Select Quantity' on clicking 'Finish' (#19136)
The dialog box fetched 0 as Quantity to Manufacture and Max Quantity on finishing a Work Order
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index ce7b4f9..96e44c8 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -545,11 +545,14 @@
get_max_transferable_qty: (frm, purpose) => {
let max = 0;
- if (frm.doc.skip_transfer) return max;
- if (purpose === 'Manufacture') {
- max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty);
+ if (frm.doc.skip_transfer) {
+ max = flt(frm.doc.qty) - flt(frm.doc.produced_qty);
} else {
- max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing);
+ if (purpose === 'Manufacture') {
+ max = flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty);
+ } else {
+ max = flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing);
+ }
}
return flt(max, precision('qty'));
},