test(perf): eliminate repeat creation of HSN codes (bp #25947)
This commit is contained in:
parent
387de3f3fa
commit
a424c0c023
@ -27,6 +27,9 @@ def setup_company_independent_fixtures(patch=False):
|
||||
add_print_formats()
|
||||
|
||||
def add_hsn_sac_codes():
|
||||
if frappe.flags.in_test and frappe.flags.created_hsn_codes:
|
||||
return
|
||||
|
||||
# HSN codes
|
||||
with open(os.path.join(os.path.dirname(__file__), 'hsn_code_data.json'), 'r') as f:
|
||||
hsn_codes = json.loads(f.read())
|
||||
@ -38,6 +41,9 @@ def add_hsn_sac_codes():
|
||||
sac_codes = json.loads(f.read())
|
||||
create_hsn_codes(sac_codes, code_field="sac_code")
|
||||
|
||||
if frappe.flags.in_test:
|
||||
frappe.flags.created_hsn_codes = True
|
||||
|
||||
def create_hsn_codes(data, code_field):
|
||||
for d in data:
|
||||
hsn_code = frappe.new_doc('GST HSN Code')
|
||||
|
Loading…
x
Reference in New Issue
Block a user