From 007548b79cc0efdbb5a4221ee8cc6f9ec003b247 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 31 Mar 2020 10:07:51 +0530 Subject: [PATCH] fix: Bank Account patch (#21124) --- .../v12_0/move_bank_account_swift_number_to_bank.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py b/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py index 4aad1420e3..3c9758eb84 100644 --- a/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py +++ b/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py @@ -4,11 +4,12 @@ import frappe def execute(): frappe.reload_doc('accounts', 'doctype', 'bank', force=1) - frappe.db.sql(""" - UPDATE `tabBank` b, `tabBank Account` ba - SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code - WHERE b.name = ba.bank - """) + if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account'): + frappe.db.sql(""" + UPDATE `tabBank` b, `tabBank Account` ba + SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code + WHERE b.name = ba.bank + """) frappe.reload_doc('accounts', 'doctype', 'bank_account') frappe.reload_doc('accounts', 'doctype', 'payment_request') \ No newline at end of file