refactor: patch old contract with full party name

This commit is contained in:
ruthra kumar
2025-05-23 14:24:50 +05:30
parent 752024e222
commit 8e2221178b
2 changed files with 16 additions and 0 deletions

View File

@@ -415,3 +415,4 @@ 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

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)