Applied the delete method of the Account data model to the delete_account view, to make things easier.
This commit is contained in:
parent
570c84c196
commit
d78b941674
@ -159,9 +159,7 @@ def delete_account(account: Account) -> redirect:
|
|||||||
:return: The redirection to the account list on success, or the account
|
:return: The redirection to the account list on success, or the account
|
||||||
detail on error.
|
detail on error.
|
||||||
"""
|
"""
|
||||||
for l10n in account.l10n:
|
account.delete()
|
||||||
db.session.delete(l10n)
|
|
||||||
db.session.delete(account)
|
|
||||||
sort_accounts_in(account.base_code, account.id)
|
sort_accounts_in(account.base_code, account.id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash(lazy_gettext("The account is deleted successfully."), "success")
|
flash(lazy_gettext("The account is deleted successfully."), "success")
|
||||||
|
Loading…
Reference in New Issue
Block a user