refactor(test): move tax category custom field creation to bootstrap

(cherry picked from commit 4454af8efd)
This commit is contained in:
ruthra kumar
2026-03-20 17:05:39 +05:30
parent ebe45add4c
commit d41e7098bd
2 changed files with 19 additions and 18 deletions

View File

@@ -18,7 +18,6 @@ class TestTaxWithholdingCategory(ERPNextTestSuite):
# create relevant supplier, etc
create_records()
create_tax_withholding_category_records()
make_pan_no_field()
def validate_tax_withholding_entries(self, doctype, docname, expected_entries):
"""Validate tax withholding entries for a document"""
@@ -3998,18 +3997,3 @@ def create_lower_deduction_certificate(
"certificate_limit": limit,
}
).insert()
def make_pan_no_field():
pan_field = {
"Supplier": [
{
"fieldname": "pan",
"label": "PAN",
"fieldtype": "Data",
"translatable": 0,
}
]
}
create_custom_fields(pan_field, update=1)

View File

@@ -8,6 +8,7 @@ from typing import Any, NewType
import frappe
from frappe import _
from frappe.core.doctype.report.report import get_report_module_dotted_path
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.tests.utils import load_test_records_for
from frappe.utils import now_datetime, today
@@ -246,14 +247,16 @@ class BootStrapTestData:
frappe.db.commit() # nosemgrep
# Dimensions
# DDL commands have implicit commit
# Dimensions
self.make_dimensions()
# custom doctype
# DDL commands have implicit commit
self.make_custom_doctype()
# custom field
self.make_custom_field()
def update_system_settings(self):
system_settings = frappe.get_doc("System Settings")
system_settings.time_zone = "Asia/Kolkata"
@@ -2829,6 +2832,20 @@ class BootStrapTestData:
]
self.make_records(["document_type"], records)
def make_custom_field(self):
pan_field = {
"Supplier": [
{
"fieldname": "pan",
"label": "PAN",
"fieldtype": "Data",
"translatable": 0,
}
]
}
create_custom_fields(pan_field, update=1)
BootStrapTestData()