Merge pull request #40197 from ruthra-kumar/ignore_self_on_gl_account_valiation

fix: ignore self on GL account validation for Bank Account
This commit is contained in:
ruthra kumar 2024-02-29 19:54:32 +05:30 committed by GitHub
commit 983f71975a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,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),