Files
erpnext/erpnext/stock/report/test_reports.py
Nabin Hait d392660d45 chore: release version 15.39.1 (#43800)
* fix: map doc from purchase order

(cherry picked from commit 60ceb91ace)

* test: auto create purchase receipt

(cherry picked from commit 59887bbc13)

* fix: better implementation, handle missing purchase order

(cherry picked from commit 66211dafd6)

* perf: performance optimizations for accounting reports by refactoring account closing balance and period closing voucher (#43798)

* fix: Gl Entry form cleanup

* fix: Added indexes in gl entry table

* perf: Refactored period closing voucher to handle large volume of gle

* fix: fixes as per new period start and end date fields in PCV

* perf: performance optimization for  accounting reports

* perf: performance optimizations for account closing balance patch

* fix: test cases

* fix: lenter issues - direct use of sql query

* fix: test cases

* fix: test cases

* fix: test cases

* fix: wrong fieldname

* fix: test cases

---------

Co-authored-by: Ninad1306 <ninad_1063@yahoo.com>
Co-authored-by: Smit Vora <smitvora203@gmail.com>
2024-10-23 14:27:10 +05:30

91 lines
2.7 KiB
Python

import unittest
import frappe
from frappe.utils.make_random import get_random
from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report
DEFAULT_FILTERS = {
"company": "_Test Company",
"from_date": "2010-01-01",
"to_date": "2030-01-01",
}
batch = get_random("Batch")
REPORT_FILTER_TEST_CASES: list[tuple[ReportName, ReportFilters]] = [
("Stock Ledger", {"_optional": True}),
("Stock Ledger", {"batch_no": batch}),
("Stock Ledger", {"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"}),
("Stock Balance", {"_optional": True}),
("Stock Projected Qty", {"_optional": True}),
("Batch-Wise Balance History", {}),
("Itemwise Recommended Reorder Level", {"item_group": "All Item Groups"}),
("COGS By Item Group", {}),
("Stock Qty vs Serial No Count", {"warehouse": "_Test Warehouse - _TC"}),
(
"Stock and Account Value Comparison",
{
"company": "_Test Company with perpetual inventory",
"account": "Stock In Hand - TCP1",
"as_on_date": "2021-01-01",
},
),
("Product Bundle Balance", {"date": "2022-01-01", "_optional": True}),
(
"Stock Analytics",
{
"from_date": "2021-01-01",
"to_date": "2021-12-31",
"value_quantity": "Quantity",
"_optional": True,
},
),
("Warehouse wise Item Balance Age and Value", {"_optional": True}),
(
"Item Variant Details",
{
"item": "_Test Variant Item",
},
),
(
"Total Stock Summary",
{
"group_by": "warehouse",
},
),
("Batch Item Expiry Status", {}),
("Incorrect Stock Value Report", {"company": "_Test Company with perpetual inventory"}),
("Incorrect Serial No Valuation", {}),
("Incorrect Balance Qty After Transaction", {}),
("Supplier-Wise Sales Analytics", {}),
("Item Prices", {"items": "Enabled Items only"}),
("Delayed Item Report", {"based_on": "Sales Invoice"}),
("Delayed Item Report", {"based_on": "Delivery Note"}),
("Stock Ageing", {"range": "30, 60, 90", "_optional": True}),
("Stock Ledger Invariant Check", {"warehouse": "_Test Warehouse - _TC", "item": "_Test Item"}),
("FIFO Queue vs Qty After Transaction Comparison", {"warehouse": "_Test Warehouse - _TC"}),
("FIFO Queue vs Qty After Transaction Comparison", {"item_group": "All Item Groups"}),
]
OPTIONAL_FILTERS = {
"warehouse": "_Test Warehouse - _TC",
"item": "_Test Item",
"item_group": "_Test Item Group",
}
class TestReports(unittest.TestCase):
def test_execute_all_stock_reports(self):
"""Test that all script report in stock modules are executable with supported filters"""
for report, filter in REPORT_FILTER_TEST_CASES:
with self.subTest(report=report):
execute_script_report(
report_name=report,
module="Stock",
filters=filter,
default_filters=DEFAULT_FILTERS,
optional_filters=OPTIONAL_FILTERS if filter.get("_optional") else None,
)