Merge pull request #57522 from mihir-kandoi/fix-subcontracting-receipt-title

fix(subcontracting): stop the Subcontracting Receipt title from going stale
This commit is contained in:
Mihir Kandoi
2026-07-28 12:19:21 +05:30
committed by GitHub
2 changed files with 20 additions and 5 deletions

View File

@@ -7,7 +7,6 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"naming_series",
"supplier",
"supplier_name",
@@ -63,6 +62,7 @@
"total_additional_costs",
"tab_other_info",
"more_info",
"title",
"amended_from",
"range",
"column_break4",
@@ -91,10 +91,8 @@
"fields": [
{
"allow_on_submit": 1,
"default": "{supplier_name}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1
@@ -679,7 +677,7 @@
"in_create": 1,
"is_submittable": 1,
"links": [],
"modified": "2026-02-27 17:59:44.107193",
"modified": "2026-07-28 13:04:52.771908",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt",
@@ -747,6 +745,6 @@
"sort_order": "DESC",
"states": [],
"timeline_field": "supplier",
"title_field": "title",
"title_field": "supplier_name",
"track_changes": 1
}

View File

@@ -44,3 +44,20 @@ class TestInit(ERPNextTestSuite):
from frappe.tests.test_patches import check_patch_files
check_patch_files("erpnext")
def test_no_unrendered_title_templates(self):
import frappe
modules = frappe.get_all("Module Def", filters={"app_name": "erpnext"}, pluck="name")
for doctype in frappe.get_all("DocType", filters={"module": ("in", modules)}, pluck="name"):
meta = frappe.get_meta(doctype)
field = meta.get_field("title")
if not field or not field.default or "{" not in field.default:
continue
self.assertEqual(
meta.title_field,
"title",
f"{doctype}: title default {field.default!r} is stored verbatim because "
"Document.set_title_field() only renders it when title_field is 'title'",
)