updated code of prajakta block,payment, gst
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, jsonify
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, jsonify, flash
|
||||
from flask_login import login_required, current_user
|
||||
from model.payment import Paymentmodel
|
||||
from model.Log import LogHelper
|
||||
@@ -88,16 +88,14 @@ def edit_payment(payment_id):
|
||||
|
||||
|
||||
# ------------------- Delete Payment -------------------
|
||||
@payment_bp.route('/delete_payment/<int:payment_id>', methods=['GET', 'POST'])
|
||||
@payment_bp.route('/delete_payment/<int:payment_id>', methods=['POST'])
|
||||
@login_required
|
||||
def delete_payment(payment_id):
|
||||
success, pmc_no, invoice_no = Paymentmodel.delete_payment(payment_id)
|
||||
if not success:
|
||||
return jsonify({"message": "Payment not found or failed to delete", "status": "error"}), 404
|
||||
flash("Payment not found or failed to delete", "error")
|
||||
else:
|
||||
LogHelper.log_action("Delete Payment", f"User {current_user.id} deleted Payment '{payment_id}'")
|
||||
flash(f"Payment ID {payment_id} deleted successfully.", "success")
|
||||
|
||||
LogHelper.log_action("Delete Payment", f"User {current_user.id} deleted Payment '{payment_id}'")
|
||||
|
||||
return jsonify({
|
||||
"message": f"Payment ID {payment_id} deleted successfully.",
|
||||
"status": "success"
|
||||
}), 200
|
||||
return redirect(url_for('payment_bp.add_payment'))
|
||||
Reference in New Issue
Block a user