fix: Material Consumption option in case of Skip Transfer to WIP in WO

(cherry picked from commit 8ea6983734)
This commit is contained in:
Sagar Sharma
2022-11-01 19:30:06 +05:30
committed by Mergify
parent 9961037f71
commit 418c131331

View File

@@ -555,13 +555,10 @@ erpnext.work_order = {
}
}
if(!frm.doc.skip_transfer){
if (frm.doc.status != 'Stopped') {
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
if (flt(doc.material_transferred_for_manufacturing) > 0 && frm.doc.status != 'Stopped') {
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
frm.has_finish_btn = true;
if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
if (flt(doc.material_transferred_for_manufacturing) > 0 || frm.doc.skip_transfer) {
// Only show "Material Consumption" when required_qty > consumed_qty
var counter = 0;
var tbl = frm.doc.required_items || [];
@@ -580,6 +577,12 @@ erpnext.work_order = {
consumption_btn.addClass('btn-primary');
}
}
}
if(!frm.doc.skip_transfer){
if (flt(doc.material_transferred_for_manufacturing) > 0) {
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
frm.has_finish_btn = true;
var finish_btn = frm.add_custom_button(__('Finish'), function() {
erpnext.work_order.make_se(frm, 'Manufacture');
@@ -606,7 +609,7 @@ erpnext.work_order = {
}
}
} else {
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
if ((flt(doc.produced_qty) < flt(doc.qty))) {
var finish_btn = frm.add_custom_button(__('Finish'), function() {
erpnext.work_order.make_se(frm, 'Manufacture');
});
@@ -614,7 +617,7 @@ erpnext.work_order = {
}
}
}
}
},
calculate_cost: function(doc) {
if (doc.operations){