Merge pull request #57493 from aerele/fix-subcontracting-title-template

fix: stop storing raw title template on subcontracting orders
This commit is contained in:
Mihir Kandoi
2026-07-28 10:41:59 +05:30
committed by GitHub
4 changed files with 33 additions and 8 deletions

View File

@@ -503,3 +503,4 @@ erpnext.patches.v16_0.enable_book_stock_expense_gl_entries
execute:frappe.db.set_single_value("Stock Settings", "use_inline_serial_batch_editor", 0)
erpnext.patches.v16_0.recalculate_bins_for_production_plan_items
erpnext.patches.v16_0.rename_ar_ap_ageing_filter
erpnext.patches.v16_0.fix_subcontracting_titles

View File

@@ -0,0 +1,28 @@
import frappe
def execute():
"""
This patch corrects the titles of the subcontracting order doctypes set to
the text strings "{customer_name}" or "{supplier_name}" instead of the
actual customer or supplier name.
Their `title_field` never pointed at `title`, so the template default was
stored verbatim instead of being substituted.
"""
party_fields = {
"Subcontracting Order": "supplier_name",
"Subcontracting Inward Order": "customer_name",
}
for doctype, party_field in party_fields.items():
if not frappe.db.has_column(doctype, "title"):
continue
table = frappe.qb.DocType(doctype)
(
frappe.qb.update(table)
.set(table.title, table[party_field])
.where(table.title == f"{{{party_field}}}")
).run()

View File

@@ -8,7 +8,6 @@
"document_type": "Document",
"engine": "InnoDB",
"field_order": [
"title",
"naming_series",
"sales_order",
"customer",
@@ -29,6 +28,7 @@
"service_items_section",
"service_items",
"tab_other_info",
"title",
"order_status_section",
"status",
"per_raw_material_received",
@@ -43,10 +43,8 @@
"fields": [
{
"allow_on_submit": 1,
"default": "{customer_name}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1
@@ -306,7 +304,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2026-02-26 17:16:21.697846",
"modified": "2026-07-27 11:20:14.512336",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Inward Order",

View File

@@ -8,7 +8,6 @@
"document_type": "Document",
"engine": "InnoDB",
"field_order": [
"title",
"naming_series",
"purchase_order",
"supplier",
@@ -55,6 +54,7 @@
"additional_costs",
"total_additional_costs",
"tab_other_info",
"title",
"order_status_section",
"status",
"column_break_39",
@@ -69,10 +69,8 @@
"fields": [
{
"allow_on_submit": 1,
"default": "{supplier_name}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1
@@ -494,7 +492,7 @@
"icon": "fa fa-file-text",
"is_submittable": 1,
"links": [],
"modified": "2025-11-14 10:31:40.682892",
"modified": "2026-07-27 11:20:14.512336",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order",