mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 15:25:19 +00:00
fix: correct titles set to {customer_name} or {supplier_name} text strings (backport #54656) (#54669)
Co-authored-by: Trusted Computer <75872475+trustedcomputer@users.noreply.github.com> Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com> fix: correct titles set to {customer_name} or {supplier_name} text strings (#54656)
This commit is contained in:
@@ -479,4 +479,4 @@ erpnext.patches.v16_0.merge_repost_settings_to_accounts_settings
|
|||||||
erpnext.patches.v16_0.set_root_type_in_account_categories
|
erpnext.patches.v16_0.set_root_type_in_account_categories
|
||||||
erpnext.patches.v16_0.scr_inv_dimension
|
erpnext.patches.v16_0.scr_inv_dimension
|
||||||
erpnext.patches.v16_0.packed_item_inv_dimen
|
erpnext.patches.v16_0.packed_item_inv_dimen
|
||||||
erpnext.patches.v16_0.correct_po_titles
|
erpnext.patches.v16_0.fix_titles
|
||||||
|
|||||||
@@ -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()
|
|
||||||
28
erpnext/patches/v16_0/fix_titles.py
Normal file
28
erpnext/patches/v16_0/fix_titles.py
Normal 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()
|
||||||
Reference in New Issue
Block a user