Skip to content

Commit

Permalink
fix: performance issue for the report Purchase Order Analysis report …
Browse files Browse the repository at this point in the history
…(backport #42503) (#42507)

fix: performance issue for the report Purchase Order Analysis report (#42503)

(cherry picked from commit cb522f8)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Jul 29, 2024
1 parent ac2ef21 commit edf1fcb
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ def validate_filters(filters):
def get_data(filters):
po = frappe.qb.DocType("Purchase Order")
po_item = frappe.qb.DocType("Purchase Order Item")
pi = frappe.qb.DocType("Purchase Invoice")
pi_item = frappe.qb.DocType("Purchase Invoice Item")

query = (
frappe.qb.from_(po)
.from_(po_item)
.inner_join(po_item)
.on(po_item.parent == po.name)
.left_join(pi_item)
.on(pi_item.po_detail == po_item.name & pi_item.docstatus == 1)
.left_join(pi)
.on(pi.name == pi_item.parent & pi.docstatus == 1)
.on((pi_item.po_detail == po_item.name) & (pi_item.docstatus == 1))
.select(
po.transaction_date.as_("date"),
po_item.schedule_date.as_("required_date"),
Expand Down

0 comments on commit edf1fcb

Please sign in to comment.