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

This commit is contained in:
Saqib Ansari 2022-03-09 16:41:54 +05:30 committed by GitHub
parent 17e16247b1
commit 4d8798b0ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,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')