mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
fix: stop storing raw title template on subcontracting orders
subcontracting order and subcontracting inward order carry a hidden
title field defaulting to "{supplier_name}" / "{customer_name}", while
their title_field points at supplier_name / customer_name. document.
set_title_field() substitutes the template only when title_field is
"title", so every record stores the placeholder verbatim.
drop the dead default and hidden flags, move title into the other info
tab to match purchase order, and add a patch to repair existing rows.
(cherry picked from commit 5008e6126f)
This commit is contained in:
@@ -493,3 +493,4 @@ erpnext.patches.v16_0.backfill_pick_list_transferred_qty
|
|||||||
erpnext.patches.v16_0.access_control_for_project_users
|
erpnext.patches.v16_0.access_control_for_project_users
|
||||||
erpnext.patches.v16_0.enable_book_stock_expense_gl_entries
|
erpnext.patches.v16_0.enable_book_stock_expense_gl_entries
|
||||||
erpnext.patches.v16_0.rename_ar_ap_ageing_filter
|
erpnext.patches.v16_0.rename_ar_ap_ageing_filter
|
||||||
|
erpnext.patches.v16_0.fix_subcontracting_titles
|
||||||
|
|||||||
28
erpnext/patches/v16_0/fix_subcontracting_titles.py
Normal file
28
erpnext/patches/v16_0/fix_subcontracting_titles.py
Normal 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()
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"title",
|
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"sales_order",
|
"sales_order",
|
||||||
"customer",
|
"customer",
|
||||||
@@ -29,6 +28,7 @@
|
|||||||
"service_items_section",
|
"service_items_section",
|
||||||
"service_items",
|
"service_items",
|
||||||
"tab_other_info",
|
"tab_other_info",
|
||||||
|
"title",
|
||||||
"order_status_section",
|
"order_status_section",
|
||||||
"status",
|
"status",
|
||||||
"per_raw_material_received",
|
"per_raw_material_received",
|
||||||
@@ -43,10 +43,8 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"default": "{customer_name}",
|
|
||||||
"fieldname": "title",
|
"fieldname": "title",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
|
||||||
"label": "Title",
|
"label": "Title",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
@@ -306,7 +304,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-02-26 17:16:21.697846",
|
"modified": "2026-07-27 11:20:14.512336",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Subcontracting",
|
"module": "Subcontracting",
|
||||||
"name": "Subcontracting Inward Order",
|
"name": "Subcontracting Inward Order",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"title",
|
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"purchase_order",
|
"purchase_order",
|
||||||
"supplier",
|
"supplier",
|
||||||
@@ -55,6 +54,7 @@
|
|||||||
"additional_costs",
|
"additional_costs",
|
||||||
"total_additional_costs",
|
"total_additional_costs",
|
||||||
"tab_other_info",
|
"tab_other_info",
|
||||||
|
"title",
|
||||||
"order_status_section",
|
"order_status_section",
|
||||||
"status",
|
"status",
|
||||||
"column_break_39",
|
"column_break_39",
|
||||||
@@ -69,10 +69,8 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"default": "{supplier_name}",
|
|
||||||
"fieldname": "title",
|
"fieldname": "title",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
|
||||||
"label": "Title",
|
"label": "Title",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
@@ -494,7 +492,7 @@
|
|||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-11-14 10:31:40.682892",
|
"modified": "2026-07-27 11:20:14.512336",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Subcontracting",
|
"module": "Subcontracting",
|
||||||
"name": "Subcontracting Order",
|
"name": "Subcontracting Order",
|
||||||
|
|||||||
Reference in New Issue
Block a user