From caf145e3ca5fa696e5cb6c96d1a574fd9f54f99a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 23 May 2025 14:24:50 +0530 Subject: [PATCH] refactor: patch old contract with full party name (cherry picked from commit 8e2221178b00f8f148ad38bb90a6928ade9bdc23) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 9 +++++++++ .../patches/v14_0/update_full_name_in_contract.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 erpnext/patches/v14_0/update_full_name_in_contract.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 83e4c7bb569..f6ee99c86c3 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -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) diff --git a/erpnext/patches/v14_0/update_full_name_in_contract.py b/erpnext/patches/v14_0/update_full_name_in_contract.py new file mode 100644 index 00000000000..19ee055ad12 --- /dev/null +++ b/erpnext/patches/v14_0/update_full_name_in_contract.py @@ -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)