Skip to content

Commit

Permalink
fix: incorrect stock balance for inventory dimension (#43284)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3e7a7a5)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Sep 19, 2024
1 parent 34d159b commit afb1ed9
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -107,6 +107,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) {
Expand Down
5 changes: 4 additions & 1 deletion erpnext/stock/report/stock_balance/stock_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def get_group_by_key(self, row) -> tuple:
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)
Expand Down

0 comments on commit afb1ed9

Please sign in to comment.