Merge pull request #40039 from SherinKR/bank_account_validation

fix: account validation error on bank account after editing existing bank account
This commit is contained in:
ruthra kumar
2024-02-29 17:38:34 +05:30
committed by GitHub

View File

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