refactor: patch old contract with full party name

(cherry picked from commit 8e2221178b)

# Conflicts:
#	erpnext/patches.txt
This commit is contained in:
ruthra kumar
2025-05-23 14:24:50 +05:30
committed by Mergify
parent 05911ad563
commit caf145e3ca
2 changed files with 24 additions and 0 deletions

View File

@@ -375,4 +375,13 @@ erpnext.stock.doctype.stock_ledger_entry.patches.ensure_sle_indexes
erpnext.patches.v14_0.rename_group_by_to_categorize_by
execute:frappe.db.set_single_value("Accounts Settings", "receivable_payable_fetch_method", "Buffered Cursor")
erpnext.patches.v14_0.set_update_price_list_based_on
<<<<<<< HEAD
erpnext.patches.v14_0.rename_group_by_to_categorize_by_in_custom_reports
=======
erpnext.patches.v15_0.update_journal_entry_type
erpnext.patches.v15_0.set_grand_total_to_default_mop
execute:frappe.db.set_single_value("Accounts Settings", "use_new_budget_controller", True)
erpnext.patches.v15_0.rename_group_by_to_categorize_by_in_custom_reports
erpnext.patches.v15_0.remove_agriculture_roles
erpnext.patches.v14_0.update_full_name_in_contract
>>>>>>> 8e2221178b (refactor: patch old contract with full party name)

View File

@@ -0,0 +1,15 @@
import frappe
from frappe import qb
def execute():
con = qb.DocType("Contract")
for c in (
qb.from_(con)
.select(con.name, con.party_type, con.party_name)
.where(con.party_full_name.isnull())
.run(as_dict=True)
):
field = c.party_type.lower() + "_name"
if res := frappe.db.get_value(c.party_type, c.party_name, field):
frappe.db.set_value("Contract", c.name, "party_full_name", res)