mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
test: execute manufacturing reports
(cherry picked from commit da3635b94f)
This commit is contained in:
committed by
Ankush Menat
parent
408c4a6f54
commit
5ba315eb96
63
erpnext/manufacturing/report/test_reports.py
Normal file
63
erpnext/manufacturing/report/test_reports.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import unittest
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
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",
|
||||||
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REPORT_FILTER_TEST_CASES: List[Tuple[ReportName, ReportFilters]] = [
|
||||||
|
("BOM Explorer", {"bom": frappe.get_last_doc("BOM").name}),
|
||||||
|
("BOM Operations Time", {}),
|
||||||
|
("BOM Stock Calculated", {"bom": frappe.get_last_doc("BOM").name, "qty_to_make": 2}),
|
||||||
|
("BOM Stock Report", {"bom": frappe.get_last_doc("BOM").name, "qty_to_produce": 2}),
|
||||||
|
("Cost of Poor Quality Report", {}),
|
||||||
|
("Downtime Analysis", {}),
|
||||||
|
(
|
||||||
|
"Exponential Smoothing Forecasting",
|
||||||
|
{
|
||||||
|
"based_on_document": "Sales Order",
|
||||||
|
"based_on_field": "Qty",
|
||||||
|
"no_of_years": 3,
|
||||||
|
"periodicity": "Yearly",
|
||||||
|
"smoothing_constant": 0.3,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
("Job Card Summary", {"fiscal_year": "2021-2022"}),
|
||||||
|
("Production Analytics", {"range": "Monthly"}),
|
||||||
|
("Quality Inspection Summary", {}),
|
||||||
|
("Work Order Stock Report", {}),
|
||||||
|
("Work Order Summary", {"fiscal_year": "2021-2022", "age": 0}),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
if frappe.db.a_row_exists("Production Plan"):
|
||||||
|
REPORT_FILTER_TEST_CASES.append(
|
||||||
|
("Production Plan Summary", {"production_plan": frappe.get_last_doc("Production Plan").name})
|
||||||
|
)
|
||||||
|
|
||||||
|
OPTIONAL_FILTERS = {
|
||||||
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
|
"item": "_Test Item",
|
||||||
|
"item_group": "_Test Item Group",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestManufacturingReports(unittest.TestCase):
|
||||||
|
def test_execute_all_manufacturing_reports(self):
|
||||||
|
"""Test that all script report in manufacturing modules are executable with supported filters"""
|
||||||
|
for report, filter in REPORT_FILTER_TEST_CASES:
|
||||||
|
execute_script_report(
|
||||||
|
report_name=report,
|
||||||
|
module="Manufacturing",
|
||||||
|
filters=filter,
|
||||||
|
default_filters=DEFAULT_FILTERS,
|
||||||
|
optional_filters=OPTIONAL_FILTERS if filter.get("_optional") else None,
|
||||||
|
)
|
||||||
@@ -40,6 +40,7 @@ REPORT_FILTER_TEST_CASES: List[Tuple[ReportName, ReportFilters]] = [
|
|||||||
("Item Variant Details", {"item": "_Test Variant Item",}),
|
("Item Variant Details", {"item": "_Test Variant Item",}),
|
||||||
("Total Stock Summary", {"group_by": "warehouse",}),
|
("Total Stock Summary", {"group_by": "warehouse",}),
|
||||||
("Batch Item Expiry Status", {}),
|
("Batch Item Expiry Status", {}),
|
||||||
|
("Process Loss Report", {}),
|
||||||
("Stock Ageing", {"range1": 30, "range2": 60, "range3": 90, "_optional": True}),
|
("Stock Ageing", {"range1": 30, "range2": 60, "range3": 90, "_optional": True}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user