Add button to delete balance assertion
This commit is contained in:
parent
ff0a18f83b
commit
9206c21025
@ -174,6 +174,12 @@ def balance_assertions_edit():
|
||||
if request.method == 'GET':
|
||||
return render_template('journal/balance_assertions_edit.html', assertion=assertion)
|
||||
|
||||
if request.form.get('action', None) == 'delete':
|
||||
# Delete balance assertion
|
||||
db.session.delete(assertion)
|
||||
db.session.commit()
|
||||
return redirect(request.form.get('referrer', '') or url_for('balance_assertions'))
|
||||
|
||||
quantity = round(float(request.form['amount']) * (10**AMOUNT_DPS))
|
||||
if request.form['sign'] == 'cr':
|
||||
quantity = -quantity
|
||||
|
@ -54,7 +54,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<div class="flex justify-end mt-4 space-x-2">
|
||||
{% if assertion and assertion.id %}
|
||||
<button type="submit" name="action" value="delete" class="btn-secondary text-red-600 ring-red-500" onclick="confirm('Are you sure you want to delete this balance assertion? This operation is irreversible.')">Delete</button>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user