fix: correct titles set to {customer_name} or {supplier_name} text strings (#54656)

This commit is contained in:
Trusted Computer
2026-04-30 01:28:14 -07:00
committed by GitHub
parent 231dd1856f
commit 78f654765d
3 changed files with 29 additions and 16 deletions

View File

@@ -470,7 +470,7 @@ erpnext.patches.v16_0.add_portal_redirects
erpnext.patches.v16_0.update_order_qty_and_requested_qty_based_on_mr_and_po
erpnext.patches.v16_0.complete_onboarding_steps_for_older_sites #2
erpnext.patches.v16_0.enable_serial_batch_setting
erpnext.patches.v16_0.correct_po_titles
erpnext.patches.v16_0.fix_titles
erpnext.patches.v16_0.co_by_product_patch
erpnext.patches.v16_0.update_requested_qty_packed_item
erpnext.patches.v16_0.remove_payables_receivables_workspace

View File

@@ -1,15 +0,0 @@
import frappe
def execute():
"""
This patch corrects the titles of purchase orders that were set to
the text string "{supplier_name}" instead of the actual supplier name.
"""
purchase_order = frappe.qb.DocType("Purchase Order")
(
frappe.qb.update(purchase_order)
.set(purchase_order.title, purchase_order.supplier_name)
.where(purchase_order.title == "{supplier_name}")
).run()

View File

@@ -0,0 +1,28 @@
import frappe
def execute():
"""
This patch corrects the titles of doctypes set to
the text strings "{customer_name}" or "{supplier_name}"
instead of the actual customer or supplier name.
"""
customer_doctypes = ["POS Invoice", "Sales Invoice", "Quotation", "Sales Order", "Delivery Note"]
supplier_doctypes = ["Purchase Invoice", "Purchase Order", "Purchase Receipt"]
for doctype in customer_doctypes:
customer_doctype = frappe.qb.DocType(doctype)
(
frappe.qb.update(customer_doctype)
.set(customer_doctype.title, customer_doctype.customer_name)
.where(customer_doctype.title == "{customer_name}")
).run()
for doctype in supplier_doctypes:
supplier_doctype = frappe.qb.DocType(doctype)
(
frappe.qb.update(supplier_doctype)
.set(supplier_doctype.title, supplier_doctype.supplier_name)
.where(supplier_doctype.title == "{supplier_name}")
).run()