mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 23:48:38 +00:00
test: add coverage for BOM Search report
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
28
erpnext/stock/report/bom_search/test_bom_search.py
Normal file
28
erpnext/stock/report/bom_search/test_bom_search.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# 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.report.bom_search.bom_search import execute
|
||||
from erpnext.tests.utils import ERPNextTestSuite
|
||||
|
||||
|
||||
class TestBomSearch(ERPNextTestSuite):
|
||||
def run_report(self, **extra):
|
||||
filters = frappe._dict({"search_sub_assemblies": 0})
|
||||
filters.update(extra)
|
||||
return execute(filters)[1]
|
||||
|
||||
def test_bom_found_by_contained_item(self):
|
||||
raw_material = make_item(properties={"is_stock_item": 1}).name
|
||||
finished_good = make_item(properties={"is_stock_item": 1}).name
|
||||
|
||||
bom = frappe.get_doc(doctype="BOM", item=finished_good, company="_Test Company", currency="INR")
|
||||
bom.append("items", {"item_code": raw_material, "qty": 1})
|
||||
bom.insert()
|
||||
bom.submit()
|
||||
|
||||
rows = self.run_report(item1=raw_material)
|
||||
bom_names = [row[0] for row in rows]
|
||||
self.assertIn(bom.name, bom_names)
|
||||
Reference in New Issue
Block a user