From 03d84430b6fdeaa1a5d0252de678f620fb903f1b Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 30 Jul 2026 08:22:00 +0530 Subject: [PATCH 1/2] fix(projects): read the Timesheet label from the employee field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Timesheet was the only doctype where the {...} template on `title` actually rendered: `title_field` was `title`, so `set_title_field()` seeded it from `{employee_name}` on insert. A `default` renders once, so reassigning a draft left the stored title — and every label derived from it — on the previous employee, with no way to correct it from the form because the field is hidden. Point `title_field` at `employee_name` so the label reads the live field instead of a copy that drifts. Existing rows need no backfill. --- erpnext/projects/doctype/timesheet/test_timesheet.py | 11 +++++++++++ erpnext/projects/doctype/timesheet/timesheet.json | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index 28ba6cebdef..a21baa74893 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -453,6 +453,17 @@ class TestTimesheet(ERPNextTestSuite): rate = get_timesheet_detail_rate(detail.name, timesheet.currency) self.assertEqual(rate, detail.billing_amount) + def test_title_follows_employee(self): + first = make_employee("_test_timesheet_title_one@example.com", company="_Test Company") + second = make_employee("_test_timesheet_title_two@example.com", company="_Test Company") + + timesheet = make_timesheet(first, simulate=True, do_not_submit=True) + self.assertEqual(timesheet.get_title(), frappe.db.get_value("Employee", first, "employee_name")) + + timesheet.employee = second + timesheet.save() + self.assertEqual(timesheet.get_title(), frappe.db.get_value("Employee", second, "employee_name")) + @staticmethod def _delete_if_exists(doctype, name): if frappe.db.exists(doctype, name): diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json index a703e6cd07f..ea50e074dbe 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.json +++ b/erpnext/projects/doctype/timesheet/timesheet.json @@ -49,7 +49,6 @@ "fields": [ { "allow_on_submit": 1, - "default": "{employee_name}", "fieldname": "title", "fieldtype": "Data", "hidden": 1, @@ -315,7 +314,7 @@ "idx": 1, "is_submittable": 1, "links": [], - "modified": "2026-04-08 12:43:30.658074", + "modified": "2026-07-30 11:04:12.882140", "modified_by": "Administrator", "module": "Projects", "name": "Timesheet", @@ -409,5 +408,5 @@ "sort_field": "creation", "sort_order": "ASC", "states": [], - "title_field": "title" + "title_field": "employee_name" } From 38e5674ea492d424f6566ff105bfa146edebf562 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 30 Jul 2026 08:22:01 +0530 Subject: [PATCH 2/2] chore(stock): drop the dead title template on Material Request `set_title()` runs in validate and always fills `title` first, so `set_title_field()` never renders `{material_request_type}`, and create_new.js skips defaults for the field `title_field` names. Titles stay " Request for ". --- erpnext/stock/doctype/material_request/material_request.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 2a455a1437c..1c6d7db5296 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -68,7 +68,6 @@ }, { "allow_on_submit": 1, - "default": "{material_request_type}", "fieldname": "title", "fieldtype": "Data", "hidden": 1, @@ -377,7 +376,7 @@ "idx": 70, "is_submittable": 1, "links": [], - "modified": "2026-03-09 17:15:30.124509", + "modified": "2026-07-30 11:04:31.517204", "modified_by": "Administrator", "module": "Stock", "name": "Material Request",