test: dynamic current FY creation in before_tests
This commit is contained in:
parent
6b638a196b
commit
51873da4bc
@ -5,10 +5,9 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import add_days, flt, get_datetime_str, nowdate
|
||||
from frappe.utils.data import now_datetime
|
||||
from frappe.utils.nestedset import get_ancestors_of, get_root_of # noqa
|
||||
|
||||
# required for backward compatibility
|
||||
from frappe.utils.nestedset import get_ancestors_of, get_root_of # noqa
|
||||
from erpnext import get_default_company
|
||||
|
||||
|
||||
@ -16,6 +15,7 @@ def before_tests():
|
||||
frappe.clear_cache()
|
||||
# complete setup if missing
|
||||
from frappe.desk.page.setup_wizard.setup_wizard import setup_complete
|
||||
current_year = now_datetime().year
|
||||
if not frappe.get_list("Company"):
|
||||
setup_complete({
|
||||
"currency" :"USD",
|
||||
@ -25,8 +25,8 @@ def before_tests():
|
||||
"company_abbr" :"WP",
|
||||
"industry" :"Manufacturing",
|
||||
"country" :"United States",
|
||||
"fy_start_date" :"2021-01-01",
|
||||
"fy_end_date" :"2021-12-31",
|
||||
"fy_start_date" :f"{current_year}-01-01",
|
||||
"fy_end_date" :f"{current_year}-12-31",
|
||||
"language" :"english",
|
||||
"company_tagline" :"Testing",
|
||||
"email" :"test@erpnext.com",
|
||||
@ -40,7 +40,6 @@ def before_tests():
|
||||
frappe.db.sql("delete from `tabSalary Slip`")
|
||||
frappe.db.sql("delete from `tabItem Price`")
|
||||
|
||||
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 0)
|
||||
enable_all_roles_and_domains()
|
||||
set_defaults_for_tests()
|
||||
|
||||
@ -136,6 +135,8 @@ def set_defaults_for_tests():
|
||||
selling_settings.territory = get_root_of("Territory")
|
||||
selling_settings.save()
|
||||
|
||||
frappe.db.set_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing", 0)
|
||||
|
||||
|
||||
def insert_record(records):
|
||||
for r in records:
|
||||
|
Loading…
x
Reference in New Issue
Block a user