fix: incorrect stock balance for inventory dimension (backport #43284) (#43289)

* fix: incorrect stock balance for inventory dimension (#43284)

(cherry picked from commit 3e7a7a54bf)

# Conflicts:
#	erpnext/stock/report/stock_balance/stock_balance.js

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-09-19 10:20:58 +05:30
committed by GitHub
parent 8abc1f4da9
commit 1bdbcc6703
2 changed files with 10 additions and 1 deletions

View File

@@ -101,6 +101,12 @@ frappe.query_reports["Stock Balance"] = {
fieldtype: "Check",
default: 0,
},
{
fieldname: "show_dimension_wise_stock",
label: __("Show Dimension Wise Stock"),
fieldtype: "Check",
default: 0,
},
],
formatter: function (value, row, column, data, default_formatter) {

View File

@@ -226,7 +226,10 @@ class StockBalanceReport:
group_by_key = [row.company, row.item_code, row.warehouse]
for fieldname in self.inventory_dimensions:
if self.filters.get(fieldname):
if not row.get(fieldname):
continue
if self.filters.get(fieldname) or self.filters.get("show_dimension_wise_stock"):
group_by_key.append(row.get(fieldname))
return tuple(group_by_key)