From d78b94167498b5139278867cb38ac3c7c7142bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 7 Feb 2023 00:22:23 +0800 Subject: [PATCH] Applied the delete method of the Account data model to the delete_account view, to make things easier. --- src/accounting/account/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/accounting/account/views.py b/src/accounting/account/views.py index 29bc7e4..90a0132 100644 --- a/src/accounting/account/views.py +++ b/src/accounting/account/views.py @@ -159,9 +159,7 @@ def delete_account(account: Account) -> redirect: :return: The redirection to the account list on success, or the account detail on error. """ - for l10n in account.l10n: - db.session.delete(l10n) - db.session.delete(account) + account.delete() sort_accounts_in(account.base_code, account.id) db.session.commit() flash(lazy_gettext("The account is deleted successfully."), "success")