Fixed so that the journal entries that has offset cannot be deleted.

This commit is contained in:
2023-03-22 00:59:43 +08:00
parent bbf3ee3320
commit 6fd37b21d9
2 changed files with 37 additions and 3 deletions

View File

@ -175,6 +175,9 @@ def delete_journal_entry(journal_entry: JournalEntry) -> redirect:
:return: The redirection to the journal entry list on success, or the
journal entry detail on error.
"""
if not journal_entry.can_delete:
flash(s(lazy_gettext("The journal entry cannot be deleted.")), "error")
return redirect(inherit_next(__get_detail_uri(journal_entry)))
journal_entry.delete()
sort_journal_entries_in(journal_entry.date, journal_entry.id)
db.session.commit()