From 75c68156738ae31e33248dc63288f2aa25fafa33 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 7 Apr 2025 11:47:27 +0530 Subject: [PATCH] fix: inventory dimensions columns visibility depends on filter --- erpnext/public/js/utils.js | 12 +++++++---- .../report/stock_balance/stock_balance.py | 21 ++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index e714b9e89f7..14e0b756476 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -247,10 +247,14 @@ $.extend(erpnext.utils, { if (!found) { filters.splice(index, 0, { - "fieldname": dimension["fieldname"], - "label": __(dimension["doctype"]), - "fieldtype": "MultiSelectList", - get_data: function(txt) { + fieldname: dimension["fieldname"], + label: __(dimension["doctype"]), + fieldtype: "MultiSelectList", + depends_on: + report_name === "Stock Balance" + ? "eval:doc.show_dimension_wise_stock === 1" + : "", + get_data: function (txt) { return frappe.db.get_link_options(dimension["doctype"], txt); }, }); diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py index 1ab2ad10f53..66979d8bf63 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.py +++ b/erpnext/stock/report/stock_balance/stock_balance.py @@ -393,16 +393,17 @@ class StockBalanceReport(object): }, ] - for dimension in get_inventory_dimensions(): - columns.append( - { - "label": _(dimension.doctype), - "fieldname": dimension.fieldname, - "fieldtype": "Link", - "options": dimension.doctype, - "width": 110, - } - ) + if self.filters.get("show_dimension_wise_stock"): + for dimension in get_inventory_dimensions(): + columns.append( + { + "label": _(dimension.doctype), + "fieldname": dimension.fieldname, + "fieldtype": "Link", + "options": dimension.doctype, + "width": 110, + } + ) columns.extend( [ -- GitLab