fix: Update patch and bank form cleanup

This commit is contained in:
Deepesh Garg 2020-03-25 21:32:10 +05:30
parent 3cf70a6e79
commit bdcfab3a0f
4 changed files with 12 additions and 35 deletions

View File

@ -13,9 +13,11 @@ frappe.ui.form.on('Bank', {
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
if (frm.doc.__islocal) {
frm.set_df_property('address_and_contact', 'hidden', 1);
frappe.contacts.clear_address_and_contact(frm);
}
else {
frm.set_df_property('address_and_contact', 'hidden', 0);
frappe.contacts.render_address_and_contact(frm);
}
},

View File

@ -9,14 +9,14 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"bank_name",
"bank_details_section",
"bank_name",
"swift_number",
"column_break_1",
"branch_code",
"website",
"address_and_contact",
"address_html",
"website",
"column_break_13",
"contact_html",
"data_import_configuration_section",
@ -44,7 +44,6 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "SWIFT number",
"reqd": 0,
"unique": 1
},
{
@ -59,7 +58,6 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Branch Code",
"reqd": 0,
"unique": 1
},
{
@ -112,40 +110,23 @@
"read_only": 1
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-11-27 16:12:13.938776",
"links": [],
"modified": "2020-03-25 21:22:33.496264",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],

View File

@ -200,7 +200,7 @@
}
],
"links": [],
"modified": "2020-01-29 20:42:26.458316",
"modified": "2020-01-30 20:42:26.458316",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Account",

View File

@ -4,17 +4,11 @@ import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank', force=1)
banks = frappe.get_all('Bank', 'name')
for bank in banks:
bank_accounts = frappe.get_all('Bank Account', filters={'bank': bank.name}, fields=['swift_number', 'branch_code'])
bank_account = ''
if len(bank_accounts):
bank_account = bank_accounts[0]
if bank_account and bank_account.swift_number:
bank.swift_number = bank_account.swift_number
if bank_account and bank_account.branch_code:
bank.branch_code = bank_account.branch_code
bank.save()
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')