diff --git a/drcr/journal/views.py b/drcr/journal/views.py index 757553c..15caaa1 100644 --- a/drcr/journal/views.py +++ b/drcr/journal/views.py @@ -78,6 +78,12 @@ def journal_edit_transaction(): if request.form.get('action', None) == 'delete': # Delete transaction db.session.delete(transaction) + + # Delete reconciliations if required + for posting in transaction.postings: + for reconciliation in StatementLineReconciliation.query.filter(StatementLineReconciliation.posting == posting): + db.session.delete(reconciliation) + db.session.commit() return redirect(url_for('journal'))