From f8bfc978d817cf7d05071eb52e25c5782b7654cf Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 29 Feb 2024 17:39:29 +0530 Subject: [PATCH] fix: ignore self on GL account validation for Bank Account --- erpnext/accounts/doctype/bank_account/bank_account.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 49c6247267f..6e85d71996a 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), -- GitLab