fix: check if swift_number exists in bank account

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
(cherry picked from commit d6587fa1d5)
This commit is contained in:
Chinmay D. Pai 2020-05-29 12:44:09 +05:30 committed by mergify-bot
parent 25add7c9bf
commit 9b36a9be26

View File

@ -4,7 +4,7 @@ import frappe
def execute(): def execute():
frappe.reload_doc('accounts', 'doctype', 'bank', force=1) frappe.reload_doc('accounts', 'doctype', 'bank', force=1)
if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account'): 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(""" frappe.db.sql("""
UPDATE `tabBank` b, `tabBank Account` ba UPDATE `tabBank` b, `tabBank Account` ba
SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code