fix: don't show non-stock items in Stock Analytics report (backport #38543) (#38545)

* fix(ux): stock-item filter for Item Code field

(cherry picked from commit ccdcb7dfcc29eb68d1cad38f3426e6fb575528eb)

* fix: don't show non-stock items in Stock Analytics report

(cherry picked from commit 01aadbef85e2570399f054027e57d6bb01af9433)

---------

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
This commit is contained in:
mergify[bot] 2023-12-04 12:18:58 +05:30 committed by GitHub
parent 0b64daf497
commit 282a5b27ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ frappe.query_reports["Stock Analytics"] = {
fieldtype: "Link",
options:"Item",
default: "",
get_query: () => ({filters: { 'is_stock_item': 1 }}),
},
{
fieldname: "value_quantity",

View File

@ -270,7 +270,7 @@ def get_items(filters):
if item_code := filters.get("item_code"):
return [item_code]
else:
item_filters = {}
item_filters = {"is_stock_item": 1}
if item_group := filters.get("item_group"):
children = get_descendants_of("Item Group", item_group, ignore_permissions=True)
item_filters["item_group"] = ("in", children + [item_group])