Skip to content

Commit

Permalink
fix: ignore self on GL account validation for Bank Account
Browse files Browse the repository at this point in the history
(cherry picked from commit 3c19186)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Feb 29, 2024
1 parent 8720115 commit 1947a67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion erpnext/accounts/doctype/bank_account/bank_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def validate(self):

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),
Expand Down

0 comments on commit 1947a67

Please sign in to comment.