17 lines
615 B
Python
17 lines
615 B
Python
|
import frappe
|
||
|
|
||
|
def _rename_single_field(**kwargs):
|
||
|
count = frappe.db.sql("SELECT COUNT(*) FROM tabSingles WHERE doctype='{doctype}' AND field='{new_name}';".format(**kwargs))[0][0]
|
||
|
if count == 0:
|
||
|
frappe.db.sql("UPDATE tabSingles SET field='{new_name}' WHERE doctype='{doctype}' AND field='{old_name}';".format(**kwargs))
|
||
|
|
||
|
def execute():
|
||
|
BR = "Bank Reconciliation"
|
||
|
AC = "account"
|
||
|
BA = "bank_account"
|
||
|
BAN = "bank_account_no"
|
||
|
|
||
|
_rename_single_field(doctype = BR, old_name = BA , new_name = AC)
|
||
|
_rename_single_field(doctype = BR, old_name = BAN, new_name = BA)
|
||
|
frappe.reload_doc("Accounts", "doctype", BR)
|