fix: test cases related to default letterhead change

(cherry picked from commit 8a2cb96c2a)
This commit is contained in:
khushi8112
2026-02-24 18:24:09 +05:30
committed by Mergify
parent b21acec711
commit 1e64dea6a0
2 changed files with 15 additions and 1 deletions

View File

@@ -18,8 +18,19 @@ class TestProcessStatementOfAccounts(AccountsTestMixin, IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
letterhead = frappe.get_doc("Letter Head", "Company Letterhead - Grey")
letterhead.is_default = 0
letterhead.save()
cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0))
@classmethod
def tearDownClass(cls):
super().tearDownClass()
letterhead = frappe.get_doc("Letter Head", "Company Letterhead - Grey")
letterhead.is_default = 1
letterhead.save()
frappe.db.commit() # nosemgrep
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -316,6 +316,9 @@ def set_default_print_formats():
if frappe.get_meta(doctype).default_print_format: if frappe.get_meta(doctype).default_print_format:
continue continue
if not frappe.db.exists("Print Format", print_format):
continue
frappe.make_property_setter( frappe.make_property_setter(
{ {
"doctype": doctype, "doctype": doctype,
@@ -345,7 +348,7 @@ def create_letter_head():
"letter_head_name": name, "letter_head_name": name,
"source": "HTML", "source": "HTML",
"content": content, "content": content,
"is_default": 1 if name == "Company Letterhead" else 0, "is_default": 1 if name == "Company Letterhead - Grey" else 0,
} }
) )
doc.insert(ignore_permissions=True) doc.insert(ignore_permissions=True)