Skip to content

Commit

Permalink
fix: warehouse filter in Product Bundle Balance (backport #42532) (#4…
Browse files Browse the repository at this point in the history
…2536)

fix: warehouse filter in Product Bundle Balance (#42532)

(cherry picked from commit 0ecfa70)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Jul 30, 2024
1 parent 3ba6f40 commit 0441984
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

frappe.query_reports["Product Bundle Balance"] = {
filters: [
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1,
},
{
fieldname: "date",
label: __("Date"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ def get_stock_ledger_entries(filters, items):
.where((sle2.name.isnull()) & (sle.docstatus < 2) & (sle.item_code.isin(items)))
)

if filters.get("company"):
query = query.where(sle.company == filters.get("company"))

if date := filters.get("date"):
query = query.where(sle.posting_date <= date)
else:
Expand All @@ -237,7 +240,7 @@ def get_stock_ledger_entries(filters, items):
if warehouse_details:
wh = frappe.qb.DocType("Warehouse")
query = query.where(
ExistsCriterion(
sle.warehouse.isin(
frappe.qb.from_(wh)
.select(wh.name)
.where((wh.lft >= warehouse_details.lft) & (wh.rgt <= warehouse_details.rgt))
Expand Down

0 comments on commit 0441984

Please sign in to comment.