fix: ignore non-unique swift numbers while migrating (#30139)

(cherry picked from commit 4d8798b0ea)

Co-authored-by: Saqib Ansari <nextchamp.saqib@gmail.com>
This commit is contained in:
mergify[bot]
2022-03-09 17:49:11 +05:30
committed by GitHub
parent 63e7d8c651
commit eb90d50946

View File

@@ -6,10 +6,13 @@ def execute():
frappe.reload_doc('accounts', 'doctype', 'bank', force=1)
if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account') and frappe.db.has_column('Bank Account', 'swift_number'):
frappe.db.sql("""
UPDATE `tabBank` b, `tabBank Account` ba
SET b.swift_number = ba.swift_number WHERE b.name = ba.bank
""")
try:
frappe.db.sql("""
UPDATE `tabBank` b, `tabBank Account` ba
SET b.swift_number = ba.swift_number WHERE b.name = ba.bank
""")
except Exception as e:
frappe.log_error(e, title="Patch Migration Failed")
frappe.reload_doc('accounts', 'doctype', 'bank_account')
frappe.reload_doc('accounts', 'doctype', 'payment_request')