Skip to content

Commit

Permalink
fix: Item Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Sep 21, 2023
1 parent 8b6430c commit b6437e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions erpnext/stock/dashboard/item_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from frappe.utils import cint, flt

from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import (
get_sre_reserved_qty_for_item_and_warehouse as get_reserved_stock,
get_sre_reserved_qty_for_items_and_warehouses as get_reserved_stock_details,
)


Expand Down Expand Up @@ -61,7 +61,10 @@ def get_data(
limit_page_length=21,
)

sre_reserved_stock_details = get_reserved_stock(item_code, warehouse)
item_code_list = [item_code] if item_code else [i.item_code for i in items]
warehouse_list = [warehouse] if warehouse else [i.warehouse for i in items]

sre_reserved_stock_details = get_reserved_stock_details(item_code_list, warehouse_list)
precision = cint(frappe.db.get_single_value("System Settings", "float_precision"))

for item in items:
Expand All @@ -75,7 +78,8 @@ def get_data(
"reserved_qty_for_production": flt(item.reserved_qty_for_production, precision),
"reserved_qty_for_sub_contract": flt(item.reserved_qty_for_sub_contract, precision),
"actual_qty": flt(item.actual_qty, precision),
"reserved_stock": sre_reserved_stock_details,
"reserved_stock": flt(sre_reserved_stock_details.get((item.item_code, item.warehouse))),
}
)

return items

0 comments on commit b6437e3

Please sign in to comment.