diff --git a/erpnext/accounts/doctype/bank_account/bank_account.json b/erpnext/accounts/doctype/bank_account/bank_account.json index 8cf90bd3e97..9ecd9c53503 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.json +++ b/erpnext/accounts/doctype/bank_account/bank_account.json @@ -132,7 +132,8 @@ "fieldtype": "Data", "in_list_view": 1, "label": "IBAN", - "length": 30 + "length": 34, + "options": "IBAN" }, { "fieldname": "column_break_12", @@ -208,6 +209,7 @@ "label": "Disabled" } ], + "grid_page_length": 50, "links": [ { "group": "Transactions", @@ -250,7 +252,7 @@ "link_fieldname": "default_bank_account" } ], - "modified": "2024-10-30 09:41:14.113414", + "modified": "2025-08-29 12:32:01.081687", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Account", @@ -282,9 +284,10 @@ "write": 1 } ], + "row_format": "Dynamic", "search_fields": "bank,account", "sort_field": "creation", "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 9c55502af6b..d8dc1191bf7 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -52,7 +52,6 @@ class BankAccount(Document): def validate(self): self.validate_company() - self.validate_iban() self.validate_account() self.update_default_bank_account() @@ -72,35 +71,6 @@ class BankAccount(Document): if self.is_company_account and not self.company: frappe.throw(_("Company is mandatory for company account")) - def validate_iban(self): - """ - Algorithm: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN - """ - # IBAN field is optional - if not self.iban: - return - - def encode_char(c): - # Position in the alphabet (A=1, B=2, ...) plus nine - return str(9 + ord(c) - 64) - - # remove whitespaces, upper case to get the right number from ord() - iban = "".join(self.iban.split(" ")).upper() - - # Move country code and checksum from the start to the end - flipped = iban[4:] + iban[:4] - - # Encode characters as numbers - encoded = [encode_char(c) if ord(c) >= 65 and ord(c) <= 90 else c for c in flipped] - - try: - to_check = int("".join(encoded)) - except ValueError: - frappe.throw(_("IBAN is not valid")) - - if to_check % 97 != 1: - frappe.throw(_("IBAN is not valid")) - def update_default_bank_account(self): if self.is_default and not self.disabled: frappe.db.set_value( diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py index b3f3469a5d9..146f426e6c7 100644 --- a/erpnext/accounts/doctype/bank_account/test_bank_account.py +++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py @@ -8,38 +8,4 @@ from frappe.tests import IntegrationTestCase class TestBankAccount(IntegrationTestCase): - def test_validate_iban(self): - valid_ibans = [ - "GB82 WEST 1234 5698 7654 32", - "DE91 1000 0000 0123 4567 89", - "FR76 3000 6000 0112 3456 7890 189", - ] - - invalid_ibans = [ - # wrong checksum (3rd place) - "GB72 WEST 1234 5698 7654 32", - "DE81 1000 0000 0123 4567 89", - "FR66 3000 6000 0112 3456 7890 189", - ] - - bank_account = frappe.get_doc({"doctype": "Bank Account"}) - - try: - bank_account.validate_iban() - except AttributeError: - msg = "BankAccount.validate_iban() failed for empty IBAN" - self.fail(msg=msg) - - for iban in valid_ibans: - bank_account.iban = iban - try: - bank_account.validate_iban() - except ValidationError: - msg = f"BankAccount.validate_iban() failed for valid IBAN {iban}" - self.fail(msg=msg) - - for not_iban in invalid_ibans: - bank_account.iban = not_iban - msg = f"BankAccount.validate_iban() accepted invalid IBAN {not_iban}" - with self.assertRaises(ValidationError, msg=msg): - bank_account.validate_iban() + pass diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json index 89a4b5b8014..da935b3ffe1 100644 --- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json +++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json @@ -146,6 +146,7 @@ "fieldname": "iban", "fieldtype": "Data", "label": "IBAN", + "options": "IBAN", "read_only": 1 }, { @@ -214,9 +215,10 @@ "read_only": 1 } ], + "grid_page_length": 50, "is_submittable": 1, "links": [], - "modified": "2024-03-27 13:06:37.731207", + "modified": "2025-08-29 11:52:33.550847", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Guarantee", @@ -250,9 +252,10 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "search_fields": "customer", "sort_field": "creation", "sort_order": "DESC", "states": [], "title_field": "customer" -} \ No newline at end of file +} diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.json b/erpnext/accounts/doctype/bank_transaction/bank_transaction.json index 62033126060..ec4dcc8a8d4 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.json +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.json @@ -223,7 +223,8 @@ { "fieldname": "bank_party_iban", "fieldtype": "Data", - "label": "Party IBAN (Bank Statement)" + "label": "Party IBAN (Bank Statement)", + "options": "IBAN" }, { "fieldname": "bank_party_account_number", @@ -238,7 +239,7 @@ "grid_page_length": 50, "is_submittable": 1, "links": [], - "modified": "2025-06-18 17:24:57.044666", + "modified": "2025-08-29 11:53:45.908169", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Transaction", diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json index 01df72aa07e..81b879c285d 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.json +++ b/erpnext/accounts/doctype/payment_request/payment_request.json @@ -228,7 +228,8 @@ "fetch_from": "bank_account.iban", "fieldname": "iban", "fieldtype": "Read Only", - "label": "IBAN" + "label": "IBAN", + "options": "IBAN" }, { "fetch_from": "bank_account.branch_code", @@ -458,11 +459,12 @@ "label": "Phone Number" } ], + "grid_page_length": 50, "in_create": 1, "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2025-01-04 05:39:32.448857", + "modified": "2025-08-29 11:52:48.555415", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Request", @@ -497,8 +499,9 @@ "write": 1 } ], + "row_format": "Dynamic", "show_preview_popup": 1, "sort_field": "creation", "sort_order": "DESC", "states": [] -} \ No newline at end of file +} diff --git a/erpnext/setup/doctype/employee/employee.json b/erpnext/setup/doctype/employee/employee.json index 635f359d651..e663913e8d7 100644 --- a/erpnext/setup/doctype/employee/employee.json +++ b/erpnext/setup/doctype/employee/employee.json @@ -814,7 +814,8 @@ "depends_on": "eval:doc.salary_mode == 'Bank'", "fieldname": "iban", "fieldtype": "Data", - "label": "IBAN" + "label": "IBAN", + "options": "IBAN" } ], "icon": "fa fa-user", @@ -822,7 +823,7 @@ "image_field": "image", "is_tree": 1, "links": [], - "modified": "2025-07-04 08:29:34.347269", + "modified": "2025-08-29 11:52:12.819878", "modified_by": "Administrator", "module": "Setup", "name": "Employee", @@ -864,6 +865,7 @@ "write": 1 } ], + "row_format": "Dynamic", "search_fields": "employee_name", "show_name_in_global_search": 1, "sort_field": "creation", @@ -871,4 +873,4 @@ "states": [], "title_field": "employee_name", "track_changes": 1 -} \ No newline at end of file +}