fix: Purchase Order Analysis Report Data (backport #42387) (#42394)

fix: Purchase Order Analysis Report Data (#42387)

(cherry picked from commit 67bf9bec47)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-07-19 14:49:39 +05:30
committed by GitHub
parent 7893a957cb
commit 709be13e82

View File

@@ -46,9 +46,9 @@ def get_data(filters):
frappe.qb.from_(po)
.from_(po_item)
.left_join(pi_item)
.on(pi_item.po_detail == po_item.name)
.on(pi_item.po_detail == po_item.name & pi_item.docstatus == 1)
.left_join(pi)
.on(pi.name == pi_item.parent)
.on(pi.name == pi_item.parent & pi.docstatus == 1)
.select(
po.transaction_date.as_("date"),
po_item.schedule_date.as_("required_date"),
@@ -72,7 +72,6 @@ def get_data(filters):
po_item.name,
)
.where((po_item.parent == po.name) & (po.status.notin(("Stopped", "Closed"))) & (po.docstatus == 1))
.where(pi.docstatus == 1)
.groupby(po_item.name)
.orderby(po.transaction_date)
)