diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 49c6247267fa757d25659b87a467b6df44c34a66..6e85d71996a5f60e5c7d0189dc9d2cfaf51cf707 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -9,14 +9,10 @@ from frappe.contacts.address_and_contact import ( load_address_and_contact, ) from frappe.model.document import Document - from frappe.utils import comma_and, get_link_to_form - - from schwifty import IBAN - class BankAccount(Document): # begin: auto-generated types # This code is auto-generated. Do not modify anything in this block. @@ -67,7 +63,9 @@ class BankAccount(Document): def validate_account(self): if self.account: - if accounts := frappe.db.get_all("Bank Account", filters={"account": self.account}, as_list=1): + if accounts := frappe.db.get_all( + "Bank Account", filters={"account": self.account, "name": ["!=", self.name]}, as_list=1 + ): frappe.throw( _("'{0}' account is already used by {1}. Use another account.").format( frappe.bold(self.account),