fix: Move branch code back to bank account (#22725)

* fix: Move branch code back to bank account

* fix: Patch
This commit is contained in:
Deepesh Garg 2020-07-22 18:21:04 +05:30 committed by GitHub
parent 3e4b5e5496
commit 7c50f421e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 17 deletions

View File

@ -13,7 +13,6 @@
"bank_name",
"swift_number",
"column_break_1",
"branch_code",
"website",
"address_and_contact",
"address_html",
@ -51,15 +50,6 @@
"fieldtype": "Column Break",
"search_index": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "branch_code",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Branch Code",
"unique": 1
},
{
"fieldname": "address_and_contact",
"fieldtype": "Section Break",
@ -111,7 +101,7 @@
}
],
"links": [],
"modified": "2020-03-25 21:22:33.496264",
"modified": "2020-07-17 14:00:13.105433",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank",

View File

@ -23,6 +23,7 @@
"account_details_section",
"iban",
"column_break_12",
"branch_code",
"bank_account_no",
"address_and_contact",
"address_html",
@ -197,10 +198,16 @@
"fieldtype": "Data",
"label": "Mask",
"read_only": 1
},
{
"fieldname": "branch_code",
"fieldtype": "Data",
"in_global_search": 1,
"label": "Branch Code"
}
],
"links": [],
"modified": "2020-04-06 21:00:45.379804",
"modified": "2020-07-17 13:59:50.795412",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Account",

View File

@ -4,7 +4,7 @@
cur_frm.add_fetch('bank_account','account','account');
cur_frm.add_fetch('bank_account','bank_account_no','bank_account_no');
cur_frm.add_fetch('bank_account','iban','iban');
cur_frm.add_fetch('bank','branch_code','branch_code');
cur_frm.add_fetch('bank_account','branch_code','branch_code');
cur_frm.add_fetch('bank','swift_number','swift_number');
frappe.ui.form.on('Bank Guarantee', {

View File

@ -211,7 +211,7 @@
"label": "IBAN"
},
{
"fetch_from": "bank.branch_code",
"fetch_from": "bank_account.branch_code",
"fetch_if_empty": 1,
"fieldname": "branch_code",
"fieldtype": "Read Only",
@ -352,7 +352,7 @@
"in_create": 1,
"is_submittable": 1,
"links": [],
"modified": "2020-05-29 17:38:49.392713",
"modified": "2020-07-17 14:06:42.185763",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",

View File

@ -709,3 +709,4 @@ erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-20
erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020
erpnext.patches.v12_0.add_taxjar_integration_field
erpnext.patches.v12_0.update_item_tax_template_company
erpnext.patches.v13_0.move_branch_code_to_bank_account

View File

@ -7,8 +7,7 @@ def execute():
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, b.branch_code = ba.branch_code
WHERE b.name = ba.bank
SET b.swift_number = ba.swift_number WHERE b.name = ba.bank
""")
frappe.reload_doc('accounts', 'doctype', 'bank_account')

View File

@ -0,0 +1,17 @@
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank_account')
frappe.reload_doc('accounts', 'doctype', 'bank')
if frappe.db.has_column('Bank', 'branch_code') and frappe.db.has_column('Bank Account', 'branch_code'):
frappe.db.sql("""UPDATE `tabBank` b, `tabBank Account` ba
SET ba.branch_code = b.branch_code
WHERE ba.bank = b.name AND
ifnull(b.branch_code, '') != '' AND ifnull(ba.branch_code, '') = ''""")