Skip to content

Commit

Permalink
fix: show zero stock items filter in the stock balance report (#42147)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1dae215)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Jul 3, 2024
1 parent b15ec23 commit d8c20ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions erpnext/stock/report/stock_balance/stock_balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ frappe.query_reports["Stock Balance"] = {
fieldtype: "Check",
default: 0,
},
{
fieldname: "include_zero_stock_items",
label: __("Include Zero Stock Items"),
fieldtype: "Check",
default: 0,
},
],

formatter: function (value, row, column, data, default_formatter) {
Expand Down
7 changes: 6 additions & 1 deletion erpnext/stock/report/stock_balance/stock_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ def prepare_new_data(self):
{"reserved_stock": sre_details.get((report_data.item_code, report_data.warehouse), 0.0)}
)

if report_data and report_data.bal_qty == 0 and report_data.bal_val == 0:
if (
not self.filters.get("include_zero_stock_items")
and report_data
and report_data.bal_qty == 0
and report_data.bal_val == 0
):
continue

self.data.append(report_data)
Expand Down

0 comments on commit d8c20ee

Please sign in to comment.