Merge pull request #16548 from nabinhait/stock-balance-item
fix: Fetch data based on item group filter in item dashboard stock balance report
This commit is contained in:
commit
ad69e29334
@ -13,7 +13,13 @@ def get_data(item_code=None, warehouse=None, item_group=None,
|
|||||||
if warehouse:
|
if warehouse:
|
||||||
filters.append(['warehouse', '=', warehouse])
|
filters.append(['warehouse', '=', warehouse])
|
||||||
if item_group:
|
if item_group:
|
||||||
filters.append(['item_group', '=', item_group])
|
lft, rgt = frappe.db.get_value("Item Group", item_group, ["lft", "rgt"])
|
||||||
|
items = frappe.db.sql_list("""
|
||||||
|
select i.name from `tabItem` i
|
||||||
|
where exists(select name from `tabItem Group`
|
||||||
|
where name=i.item_group and lft >=%s and rgt<=%s)
|
||||||
|
""", (lft, rgt))
|
||||||
|
filters.append(['item_code', 'in', items])
|
||||||
try:
|
try:
|
||||||
# check if user has any restrictions based on user permissions on warehouse
|
# check if user has any restrictions based on user permissions on warehouse
|
||||||
if DatabaseQuery('Warehouse', user=frappe.session.user).build_match_conditions():
|
if DatabaseQuery('Warehouse', user=frappe.session.user).build_match_conditions():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user