Compare commits

...

2 Commits

Author SHA1 Message Date
Nabin Hait
e005d7021b test: reuse BootStrapTestData master data to reduce runtime
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 13:28:00 +05:30
Nabin Hait
403788324a test: add coverage for Stock and Account Value Comparison report
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 10:40:24 +05:30

View File

@@ -0,0 +1,43 @@
# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import frappe
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.stock.report.stock_and_account_value_comparison.stock_and_account_value_comparison import (
execute,
)
from erpnext.tests.utils import ERPNextTestSuite
COMPANY = "_Test Company with perpetual inventory"
class TestStockAndAccountValueComparison(ERPNextTestSuite):
def test_balanced_warehouse_not_flagged(self):
warehouse = create_warehouse("_Test SAVC WH", company=COMPANY)
account = frappe.get_value("Warehouse", warehouse, "account")
item = "_Test Item"
make_stock_entry(
item_code=item,
to_warehouse=warehouse,
qty=10,
rate=100,
company=COMPANY,
posting_date="2026-06-01",
)
# Filtering by the isolated account restricts both the stock-ledger and GL
# scans to this fresh warehouse's account only.
rows = self.run_report(account=account)
# The report lists only mismatches (rows where abs(difference_value) > 0.1),
# keyed per voucher. A balanced perpetual warehouse posts equal stock-ledger
# and GL values for the receipt voucher, so nothing should be flagged.
self.assertEqual(rows, [])
def run_report(self, **extra):
filters = {"company": COMPANY, "as_on_date": "2026-12-31"}
filters.update(extra)
return execute(frappe._dict(filters))[1]