Delete statement line reconciliation when deleting transaction
This commit is contained in:
parent
4aa6c610e4
commit
bbd98ee8c4
@ -78,6 +78,12 @@ def journal_edit_transaction():
|
|||||||
if request.form.get('action', None) == 'delete':
|
if request.form.get('action', None) == 'delete':
|
||||||
# Delete transaction
|
# Delete transaction
|
||||||
db.session.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()
|
db.session.commit()
|
||||||
return redirect(url_for('journal'))
|
return redirect(url_for('journal'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user