fix: `Process Loss Report`
diff --git a/erpnext/manufacturing/report/process_loss_report/process_loss_report.py b/erpnext/manufacturing/report/process_loss_report/process_loss_report.py
index ce8f4f3..c3dd9cf 100644
--- a/erpnext/manufacturing/report/process_loss_report/process_loss_report.py
+++ b/erpnext/manufacturing/report/process_loss_report/process_loss_report.py
@@ -33,10 +33,9 @@
wo.name,
wo.status,
wo.production_item,
- wo.qty,
wo.produced_qty,
wo.process_loss_qty,
- (wo.produced_qty - wo.process_loss_qty).as_("actual_produced_qty"),
+ wo.qty.as_("qty_to_manufacture"),
Sum(se.total_incoming_value).as_("total_fg_value"),
Sum(se.total_outgoing_value).as_("total_rm_value"),
)
@@ -44,6 +43,7 @@
(wo.process_loss_qty > 0)
& (wo.company == filters.company)
& (se.docstatus == 1)
+ & (se.purpose == "Manufacture")
& (se.posting_date.between(filters.from_date, filters.to_date))
)
.groupby(se.work_order)
@@ -80,19 +80,29 @@
},
{"label": _("Status"), "fieldname": "status", "fieldtype": "Data", "width": "100"},
{
+ "label": _("Qty To Manufacture"),
+ "fieldname": "qty_to_manufacture",
+ "fieldtype": "Float",
+ "width": "150",
+ },
+ {
"label": _("Manufactured Qty"),
"fieldname": "produced_qty",
"fieldtype": "Float",
"width": "150",
},
- {"label": _("Loss Qty"), "fieldname": "process_loss_qty", "fieldtype": "Float", "width": "150"},
{
- "label": _("Actual Manufactured Qty"),
- "fieldname": "actual_produced_qty",
+ "label": _("Process Loss Qty"),
+ "fieldname": "process_loss_qty",
"fieldtype": "Float",
"width": "150",
},
- {"label": _("Loss Value"), "fieldname": "total_pl_value", "fieldtype": "Float", "width": "150"},
+ {
+ "label": _("Process Loss Value"),
+ "fieldname": "total_pl_value",
+ "fieldtype": "Float",
+ "width": "150",
+ },
{"label": _("FG Value"), "fieldname": "total_fg_value", "fieldtype": "Float", "width": "150"},
{
"label": _("Raw Material Value"),
@@ -105,5 +115,5 @@
def update_data_with_total_pl_value(data: Data) -> None:
for row in data:
- value_per_unit_fg = row["total_fg_value"] / row["actual_produced_qty"]
+ value_per_unit_fg = row["total_fg_value"] / row["qty_to_manufacture"]
row["total_pl_value"] = row["process_loss_qty"] * value_per_unit_fg