Skip to content

Commit

Permalink
fix: show zero stock items filter in the stock balance report (backport
Browse files Browse the repository at this point in the history
#42147) (#42152)

fix: show zero stock items filter in the stock balance report (#42147)

(cherry picked from commit 1dae215)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Jul 3, 2024
1 parent c9cde25 commit 11ebbf2
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 11ebbf2

Please sign in to comment.