fix: incorrect planned qty in PP (backport #39785) (#39793)

fix: incorrect planned qty in PP

(cherry picked from commit a8ebc94a366e8f15e9bbeab3da064cf5f22dd1b9)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
This commit is contained in:
mergify[bot] 2024-02-08 09:13:38 +05:30 committed by GitHub
parent a5ad318a37
commit 60e04ab661
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -312,9 +312,10 @@ class ProductionPlan(Document):
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 @@ class ProductionPlan(Document):
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 = (