Merge pull request #19023 from Alchez/dev-work-order-bugs

fix: Work Order operating cost re-calculation on client-side (develop)
This commit is contained in:
rohitwaghchaure 2019-11-15 11:19:10 +05:30 committed by GitHub
commit 16f6ca12a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,6 +395,11 @@ frappe.ui.form.on("Work Order", {
}
});
}
},
additional_operating_cost: function(frm) {
erpnext.work_order.calculate_cost(frm.doc);
erpnext.work_order.calculate_total_cost(frm);
}
});
@ -534,8 +539,7 @@ erpnext.work_order = {
},
calculate_total_cost: function(frm) {
var variable_cost = frm.doc.actual_operating_cost ?
flt(frm.doc.actual_operating_cost) : flt(frm.doc.planned_operating_cost);
let variable_cost = flt(frm.doc.actual_operating_cost) || flt(frm.doc.planned_operating_cost);
frm.set_value("total_operating_cost", (flt(frm.doc.additional_operating_cost) + variable_cost));
},