Skip to content

Commit

Permalink
fix: parenttype in item wise purchase and sales register
Browse files Browse the repository at this point in the history
(cherry picked from commit 35981b8)
  • Loading branch information
ljain112 authored and mergify[bot] committed Jul 26, 2024
1 parent dd8fff6 commit 322fbe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ def apply_conditions(query, pi, pii, filters):


def get_items(filters, additional_table_columns):
pi = frappe.qb.DocType("Purchase Invoice")
pii = frappe.qb.DocType("Purchase Invoice Item")
doctype = "Purchase Invoice"
pi = frappe.qb.DocType(doctype)
pii = frappe.qb.DocType(f"{doctype} Item")
Item = frappe.qb.DocType("Item")
query = (
frappe.qb.from_(pi)
Expand Down Expand Up @@ -353,6 +354,7 @@ def get_items(filters, additional_table_columns):
pi.mode_of_payment,
)
.where(pi.docstatus == 1)
.where(pii.parenttype == doctype)
)

if filters.get("supplier"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@ def apply_group_by_conditions(query, si, ii, filters):


def get_items(filters, additional_query_columns, additional_conditions=None):
si = frappe.qb.DocType("Sales Invoice")
sii = frappe.qb.DocType("Sales Invoice Item")
doctype = "Sales Invoice"
si = frappe.qb.DocType(doctype)
sii = frappe.qb.DocType(f"{doctype} Item")
item = frappe.qb.DocType("Item")

query = (
Expand Down Expand Up @@ -459,6 +460,7 @@ def get_items(filters, additional_query_columns, additional_conditions=None):
sii.qty,
)
.where(si.docstatus == 1)
.where(sii.parenttype == doctype)
)

if additional_query_columns:
Expand Down

0 comments on commit 322fbe9

Please sign in to comment.