Added the limitation so that essential accounts, like cash, and the accounts in use, cannot be deleted.
This commit is contained in:
@ -157,6 +157,9 @@ def delete_account(account: Account) -> redirect:
|
||||
:return: The redirection to the account list on success, or the account
|
||||
detail on error.
|
||||
"""
|
||||
if not account.can_delete:
|
||||
flash(s(lazy_gettext("The account cannot be deleted.")), "error")
|
||||
return redirect(inherit_next(__get_detail_uri(account)))
|
||||
account.delete()
|
||||
sort_accounts_in(account.base_code, account.id)
|
||||
db.session.commit()
|
||||
|
Reference in New Issue
Block a user