Merge pull request #53240 from frappe/mergify/bp/version-15-hotfix/pr-53234

fix(manufacturing): show returned qty in progress bar (backport #53234)
This commit is contained in:
Mihir Kandoi
2026-03-09 12:42:04 +05:30
committed by GitHub

View File

@@ -425,10 +425,11 @@ frappe.ui.form.on("Work Order", {
var added_min = false;
// produced qty
var title = __("{0} items produced", [frm.doc.produced_qty]);
let produced_qty = frm.doc.produced_qty - frm.doc.disassembled_qty;
var title = __("{0} items produced", [produced_qty]);
bars.push({
title: title,
width: (frm.doc.produced_qty / frm.doc.qty) * 100 + "%",
width: (flt(produced_qty) / frm.doc.qty) * 100 + "%",
progress_class: "progress-bar-success",
});
if (bars[0].width == "0%") {
@@ -445,14 +446,27 @@ frappe.ui.form.on("Work Order", {
if (pending_complete > 0) {
var width = (pending_complete / frm.doc.qty) * 100 - added_min;
title = __("{0} items in progress", [pending_complete]);
let progress_class = "progress-bar-warning";
if (frm.doc.status == "Closed") {
if (frm.doc.required_items.find((d) => d.returned_qty > 0)) {
title = __("{0} items returned", [pending_complete]);
progress_class = "progress-bar-warning";
} else {
title = __("{0} items to return", [pending_complete]);
progress_class = "progress-bar-info";
}
}
bars.push({
title: title,
width: (width > 100 ? "99.5" : width) + "%",
progress_class: "progress-bar-warning",
progress_class: progress_class,
});
message = message + ". " + title;
}
}
//process loss qty
if (frm.doc.process_loss_qty) {
var process_loss_width = (frm.doc.process_loss_qty / frm.doc.qty) * 100;
title = __("{0} items lost during process.", [frm.doc.process_loss_qty]);
@@ -463,6 +477,19 @@ frappe.ui.form.on("Work Order", {
});
message = message + ". " + title;
}
// disassembled qty
if (frm.doc.disassembled_qty) {
var disassembled_width = (frm.doc.disassembled_qty / frm.doc.qty) * 100;
title = __("{0} items disassembled", [frm.doc.disassembled_qty]);
bars.push({
title: title,
width: disassembled_width + "%",
progress_class: "progress-bar-secondary",
});
message = message + ". " + title;
}
frm.dashboard.add_progress(__("Status"), bars, message);
},