From 08ce18fe58db472ea919e125479d1b254c7b614f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jun 2026 10:25:40 +0530 Subject: [PATCH 1/2] test: add coverage for Item Price Stock report Co-Authored-By: Claude Opus 4.8 (1M context) --- .../item_price_stock/test_item_price_stock.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 erpnext/stock/report/item_price_stock/test_item_price_stock.py diff --git a/erpnext/stock/report/item_price_stock/test_item_price_stock.py b/erpnext/stock/report/item_price_stock/test_item_price_stock.py new file mode 100644 index 00000000000..5b8315d99a6 --- /dev/null +++ b/erpnext/stock/report/item_price_stock/test_item_price_stock.py @@ -0,0 +1,44 @@ +# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt + +import frappe + +from erpnext.stock.doctype.item.test_item import make_item +from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry +from erpnext.stock.report.item_price_stock.item_price_stock import execute +from erpnext.tests.utils import ERPNextTestSuite + + +class TestItemPriceStock(ERPNextTestSuite): + def run_report(self, **extra): + return execute(frappe._dict(extra))[1] + + def test_price_and_stock_shown(self): + item = make_item(properties={"is_stock_item": 1}).name + + frappe.get_doc( + { + "doctype": "Item Price", + "item_code": item, + "price_list": "Standard Selling", + "price_list_rate": 300, + } + ).insert() + + make_stock_entry( + item_code=item, + to_warehouse="_Test Warehouse - _TC", + qty=7, + rate=100, + posting_date="2026-06-01", + ) + + rows = self.run_report(item_code=item) + warehouse_rows = [row for row in rows if row["warehouse"] == "_Test Warehouse - _TC"] + + self.assertEqual(len(warehouse_rows), 1) + row = warehouse_rows[0] + self.assertEqual(row["item_code"], item) + self.assertEqual(row["selling_price_list"], "Standard Selling") + self.assertEqual(row["selling_rate"], 300) + self.assertEqual(row["stock_available"], 7) From 9158d5f89381d7efc8565cd5920be88ba3e3ec0c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jun 2026 13:27:04 +0530 Subject: [PATCH 2/2] test: reuse BootStrapTestData master data to reduce runtime Co-Authored-By: Claude Opus 4.8 (1M context) --- .../report/item_price_stock/test_item_price_stock.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/report/item_price_stock/test_item_price_stock.py b/erpnext/stock/report/item_price_stock/test_item_price_stock.py index 5b8315d99a6..7d671a4437d 100644 --- a/erpnext/stock/report/item_price_stock/test_item_price_stock.py +++ b/erpnext/stock/report/item_price_stock/test_item_price_stock.py @@ -3,7 +3,6 @@ import frappe -from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.report.item_price_stock.item_price_stock import execute from erpnext.tests.utils import ERPNextTestSuite @@ -14,7 +13,7 @@ class TestItemPriceStock(ERPNextTestSuite): return execute(frappe._dict(extra))[1] def test_price_and_stock_shown(self): - item = make_item(properties={"is_stock_item": 1}).name + item = "_Test Item" frappe.get_doc( { @@ -27,14 +26,18 @@ class TestItemPriceStock(ERPNextTestSuite): make_stock_entry( item_code=item, - to_warehouse="_Test Warehouse - _TC", + to_warehouse="Stores - _TC", qty=7, rate=100, posting_date="2026-06-01", ) rows = self.run_report(item_code=item) - warehouse_rows = [row for row in rows if row["warehouse"] == "_Test Warehouse - _TC"] + warehouse_rows = [ + row + for row in rows + if row["warehouse"] == "Stores - _TC" and row["selling_price_list"] == "Standard Selling" + ] self.assertEqual(len(warehouse_rows), 1) row = warehouse_rows[0]