mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-24 09:08:30 +00:00
fix: consider process_loss_qty in work order
(cherry picked from commit 95fda47b6c)
This commit is contained in:
@@ -982,7 +982,9 @@ class JobCard(Document):
|
|||||||
if self.time_logs:
|
if self.time_logs:
|
||||||
self.status = "Work In Progress"
|
self.status = "Work In Progress"
|
||||||
|
|
||||||
if self.docstatus == 1 and (self.for_quantity <= self.total_completed_qty or not self.items):
|
if self.docstatus == 1 and (
|
||||||
|
self.for_quantity <= (self.total_completed_qty + self.process_loss_qty) or not self.items
|
||||||
|
):
|
||||||
self.status = "Completed"
|
self.status = "Completed"
|
||||||
|
|
||||||
if update_status:
|
if update_status:
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ class TestJobCard(FrappeTestCase):
|
|||||||
self.assertEqual(jc.status, status)
|
self.assertEqual(jc.status, status)
|
||||||
|
|
||||||
jc = frappe.new_doc("Job Card")
|
jc = frappe.new_doc("Job Card")
|
||||||
|
jc.process_loss_qty = 0
|
||||||
jc.for_quantity = 2
|
jc.for_quantity = 2
|
||||||
jc.transferred_qty = 1
|
jc.transferred_qty = 1
|
||||||
jc.total_completed_qty = 0
|
jc.total_completed_qty = 0
|
||||||
|
|||||||
@@ -397,7 +397,10 @@ frappe.ui.form.on("Work Order", {
|
|||||||
message = title;
|
message = title;
|
||||||
// pending qty
|
// pending qty
|
||||||
if (!frm.doc.skip_transfer) {
|
if (!frm.doc.skip_transfer) {
|
||||||
var pending_complete = frm.doc.material_transferred_for_manufacturing - frm.doc.produced_qty;
|
var pending_complete =
|
||||||
|
frm.doc.material_transferred_for_manufacturing -
|
||||||
|
frm.doc.produced_qty -
|
||||||
|
frm.doc.process_loss_qty;
|
||||||
if (pending_complete) {
|
if (pending_complete) {
|
||||||
var width = (pending_complete / frm.doc.qty) * 100 - added_min;
|
var width = (pending_complete / frm.doc.qty) * 100 - added_min;
|
||||||
title = __("{0} items in progress", [pending_complete]);
|
title = __("{0} items in progress", [pending_complete]);
|
||||||
@@ -409,6 +412,16 @@ frappe.ui.form.on("Work Order", {
|
|||||||
message = message + ". " + title;
|
message = message + ". " + title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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]);
|
||||||
|
bars.push({
|
||||||
|
title: title,
|
||||||
|
width: process_loss_width + "%",
|
||||||
|
progress_class: "progress-bar-danger",
|
||||||
|
});
|
||||||
|
message = message + ". " + title;
|
||||||
|
}
|
||||||
frm.dashboard.add_progress(__("Status"), bars, message);
|
frm.dashboard.add_progress(__("Status"), bars, message);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1519,7 +1519,9 @@ def close_work_order(work_order, status):
|
|||||||
work_order = frappe.get_doc("Work Order", work_order)
|
work_order = frappe.get_doc("Work Order", work_order)
|
||||||
if work_order.get("operations"):
|
if work_order.get("operations"):
|
||||||
job_cards = frappe.get_list(
|
job_cards = frappe.get_list(
|
||||||
"Job Card", filters={"work_order": work_order.name, "status": "Work In Progress"}, pluck="name"
|
"Job Card",
|
||||||
|
filters={"work_order": work_order.name, "status": "Work In Progress", "docstatus": 1},
|
||||||
|
pluck="name",
|
||||||
)
|
)
|
||||||
|
|
||||||
if job_cards:
|
if job_cards:
|
||||||
|
|||||||
Reference in New Issue
Block a user