From 4a6b18922176f5e58436cf5667343d4f5e1a22ad Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jun 2026 10:25:55 +0530 Subject: [PATCH 1/2] test: add coverage for Item Variant Details report Co-Authored-By: Claude Opus 4.8 (1M context) --- .../test_item_variant_details.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 erpnext/stock/report/item_variant_details/test_item_variant_details.py diff --git a/erpnext/stock/report/item_variant_details/test_item_variant_details.py b/erpnext/stock/report/item_variant_details/test_item_variant_details.py new file mode 100644 index 00000000000..7c877d26811 --- /dev/null +++ b/erpnext/stock/report/item_variant_details/test_item_variant_details.py @@ -0,0 +1,37 @@ +# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +import frappe + +from erpnext.controllers.item_variant import create_variant +from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.stock.report.item_variant_details.item_variant_details import execute +from erpnext.tests.utils import ERPNextTestSuite + + +class TestItemVariantDetails(ERPNextTestSuite): + def run_report(self, **extra): + return execute(frappe._dict(extra))[1] + + def test_variants_listed_for_template(self): + template = "_Test Variant Item" + + variant = create_variant(template, {"Test Size": "Small"}) + variant.insert(ignore_if_duplicate=True) + + make_stock_entry( + item_code=variant.name, + to_warehouse="_Test Warehouse - _TC", + qty=5, + rate=100, + ) + + rows = self.run_report(item=template) + + variant_rows = [row for row in rows if row.get("variant_name") == variant.name] + self.assertEqual(len(variant_rows), 1) + + row = variant_rows[0] + self.assertEqual(row.get("test_size"), "Small") + self.assertEqual(row.get("current_stock"), 5) + self.assertEqual(row.get("open_orders"), 0) From 67ac8f64e88fbe282fafd73e711a0a50cdbf44f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jun 2026 13:27:14 +0530 Subject: [PATCH 2/2] test: reuse BootStrapTestData master data to reduce runtime Co-Authored-By: Claude Opus 4.8 (1M context) --- .../report/item_variant_details/test_item_variant_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/report/item_variant_details/test_item_variant_details.py b/erpnext/stock/report/item_variant_details/test_item_variant_details.py index 7c877d26811..87c8ea28cb8 100644 --- a/erpnext/stock/report/item_variant_details/test_item_variant_details.py +++ b/erpnext/stock/report/item_variant_details/test_item_variant_details.py @@ -21,7 +21,7 @@ class TestItemVariantDetails(ERPNextTestSuite): make_stock_entry( item_code=variant.name, - to_warehouse="_Test Warehouse - _TC", + to_warehouse="Stores - _TC", qty=5, rate=100, )