From de15cc1387d167e41db5258364144c81a255a1c1 Mon Sep 17 00:00:00 2001 From: Marica Date: Mon, 30 Sep 2019 15:36:33 +0530 Subject: [PATCH] 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 --- .../manufacturing/doctype/work_order/work_order.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index ce7b4f9425..96e44c881b 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -545,11 +545,14 @@ erpnext.work_order = { 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')); },