diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fb8c625f6c7..9dc1947cf2f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -405,3 +405,8 @@ erpnext.patches.v15_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 erpnext.patches.v15_0.rename_group_by_to_categorize_by_in_custom_reports +<<<<<<< HEAD +======= +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)