Merge pull request #23550 from nextchamp-saqib/add-acc-to-a-group-fix
chore: validate is_group of child parent account
diff --git a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
index 55f041c..78e95df 100644
--- a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
+++ b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
@@ -6,10 +6,17 @@
from frappe import _
def execute(filters=None):
+ validate_warehouse(filters)
columns = get_columns()
data = get_data(filters.warehouse)
return columns, data
+def validate_warehouse(filters):
+ company = filters.company
+ warehouse = filters.warehouse
+ if not frappe.db.exists("Warehouse", {"name": warehouse, "company": company}):
+ frappe.throw(_("Warehouse: {0} does not belong to {1}").format(warehouse, company))
+
def get_columns():
columns = [
{