mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
refactor(test): make sales invoice deterministic
This commit is contained in:
@@ -2127,16 +2127,19 @@ class TestSalesInvoice(ERPNextTestSuite):
|
|||||||
|
|
||||||
@ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"})
|
@ERPNextTestSuite.change_settings("Selling Settings", {"sales_update_frequency": "Each Transaction"})
|
||||||
def test_company_monthly_sales(self):
|
def test_company_monthly_sales(self):
|
||||||
existing_current_month_sales = frappe.get_cached_value(
|
from erpnext.setup.doctype.company.company import update_company_current_month_sales
|
||||||
"Company", "_Test Company", "total_monthly_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()
|
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)
|
self.assertEqual(current_month_sales, existing_current_month_sales + si.base_grand_total)
|
||||||
|
|
||||||
si.cancel()
|
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)
|
self.assertEqual(current_month_sales, existing_current_month_sales)
|
||||||
|
|
||||||
def test_rounding_adjustment(self):
|
def test_rounding_adjustment(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user