From 63daba97150067146ed0b055228a27fbc5748d43 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Thu, 14 May 2026 20:13:23 +0530 Subject: [PATCH] feat(company): add a default_letter_head_report field in company doctype --- erpnext/setup/doctype/company/company.js | 16 +++++++++++++++ erpnext/setup/doctype/company/company.json | 23 +++++++++++++++++++--- erpnext/setup/doctype/company/company.py | 1 + erpnext/startup/boot.py | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index f8daf3c6f31..bc700044f63 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -69,6 +69,22 @@ frappe.ui.form.on("Company", { }, }; }); + + frm.set_query("default_letter_head", function () { + return { + filters: { + letter_head_for: "DocType", + }, + }; + }); + + frm.set_query("default_letter_head_report", function () { + return { + filters: { + letter_head_for: "Report", + }, + }; + }); }, company_name: function (frm) { diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 37eda038e3b..d8c3c227f64 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -17,12 +17,15 @@ "is_group", "default_holiday_list", "cb0", - "default_letter_head", "tax_id", "domain", "date_of_establishment", "parent_company", "reporting_currency", + "section_break_soma", + "default_letter_head", + "column_break_zqmp", + "default_letter_head_report", "company_info", "company_logo", "date_of_incorporation", @@ -253,7 +256,7 @@ { "fieldname": "default_letter_head", "fieldtype": "Link", - "label": "Default Letter Head", + "label": "Default Letter Head (DocType)", "options": "Letter Head" }, { @@ -962,6 +965,20 @@ { "fieldname": "accounts_closing_section", "fieldtype": "Section Break" + }, + { + "fieldname": "default_letter_head_report", + "fieldtype": "Link", + "label": "Default Letter Head (Report)", + "options": "Letter Head" + }, + { + "fieldname": "section_break_soma", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_zqmp", + "fieldtype": "Column Break" } ], "grid_page_length": 50, @@ -970,7 +987,7 @@ "image_field": "company_logo", "is_tree": 1, "links": [], - "modified": "2026-04-17 17:11:46.586135", + "modified": "2026-05-14 16:50:34.132345", "modified_by": "Administrator", "module": "Setup", "name": "Company", diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index d30b082e557..3c7d900f3e8 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -76,6 +76,7 @@ class Company(NestedSet): default_income_account: DF.Link | None default_inventory_account: DF.Link | None default_letter_head: DF.Link | None + default_letter_head_report: DF.Link | None default_operating_cost_account: DF.Link | None default_payable_account: DF.Link | None default_provisional_account: DF.Link | None diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index 08cf9154c2b..e9f6a5c9641 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -49,7 +49,7 @@ def boot_session(bootinfo): bootinfo.docs += frappe.db.sql( """select name, default_currency, cost_center, default_selling_terms, default_buying_terms, - default_letter_head, default_bank_account, enable_perpetual_inventory, country, exchange_gain_loss_account from `tabCompany`""", + default_letter_head, default_letter_head_report, default_bank_account, enable_perpetual_inventory, country, exchange_gain_loss_account from `tabCompany`""", as_dict=1, update={"doctype": ":Company"}, )