refactor(test): make sales invoice deterministic

This commit is contained in:
ruthra kumar
2026-03-03 08:25:42 +05:30
parent da8fcde4a8
commit 23d35c6cca

View File

@@ -2127,16 +2127,19 @@ class TestSalesInvoice(ERPNextTestSuite):
@ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"})
def test_company_monthly_sales(self):
existing_current_month_sales = frappe.get_cached_value(
"Company", "_Test Company", "total_monthly_sales"
)
from erpnext.setup.doctype.company.company import update_company_current_month_sales
company = "_Test Company"
update_company_current_month_sales(company)
existing_current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales")
si = create_sales_invoice()
current_month_sales = frappe.get_cached_value("Company", "_Test Company", "total_monthly_sales")
current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales")
self.assertEqual(current_month_sales, existing_current_month_sales + si.base_grand_total)
si.cancel()
current_month_sales = frappe.get_cached_value("Company", "_Test Company", "total_monthly_sales")
current_month_sales = frappe.db.get_value("Company", company, "total_monthly_sales")
self.assertEqual(current_month_sales, existing_current_month_sales)
def test_rounding_adjustment(self):