Skip to content

Commit

Permalink
fix: Billed Qty and Qty to Bill Calculation in Purchase Order Analysis (
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihantra-Patel authored Jul 9, 2024
1 parent 4936514 commit 0c76a8c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ 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)
.left_join(pi_item)
.on(pi_item.po_detail == po_item.name)
.left_join(pi)
.on(pi.name == pi_item.parent)
.select(
po.transaction_date.as_("date"),
po_item.schedule_date.as_("required_date"),
Expand All @@ -69,6 +72,7 @@ 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)
)
Expand Down

0 comments on commit 0c76a8c

Please sign in to comment.