fix: incorrect planned qty in PP
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index f0392be..6e9d1fc 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -312,9 +312,10 @@
so_item.parent,
so_item.item_code,
so_item.warehouse,
- (
- (so_item.qty - so_item.work_order_qty - so_item.delivered_qty) * so_item.conversion_factor
- ).as_("pending_qty"),
+ so_item.qty,
+ so_item.work_order_qty,
+ so_item.delivered_qty,
+ so_item.conversion_factor,
so_item.description,
so_item.name,
so_item.bom_no,
@@ -337,6 +338,11 @@
items = items_query.run(as_dict=True)
+ for item in items:
+ item.pending_qty = (
+ flt(item.qty) - max(item.work_order_qty, item.delivered_qty, 0) * item.conversion_factor
+ )
+
pi = frappe.qb.DocType("Packed Item")
packed_items_query = (