mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-15 08:51:50 +02:00
issue 2 fixed
This commit is contained in:
parent
77e33286aa
commit
3b74e2cea1
1 changed files with 16 additions and 10 deletions
|
@ -773,21 +773,27 @@ def edit_bill(bill_id):
|
|||
bill = Bill.query.get(g.project, bill_id)
|
||||
if not bill:
|
||||
raise NotFound()
|
||||
payer_id = bill.payer_id
|
||||
payer = Person.query.get(payer_id)
|
||||
if payer.activated:
|
||||
|
||||
form = get_billform_for(g.project, set_default=False)
|
||||
form = get_billform_for(g.project, set_default=False)
|
||||
|
||||
if request.method == "POST" and form.validate():
|
||||
form.save(bill, g.project)
|
||||
db.session.commit()
|
||||
if request.method == "POST" and form.validate():
|
||||
form.save(bill, g.project)
|
||||
db.session.commit()
|
||||
|
||||
flash(_("The bill has been modified"))
|
||||
flash(_("The bill has been modified"))
|
||||
return redirect(url_for(".list_bills"))
|
||||
|
||||
if not form.errors:
|
||||
form.fill(bill, g.project)
|
||||
|
||||
return render_template("add_bill.html", form=form, edit=True)
|
||||
else:
|
||||
flash(_("The payer is deactivated. You cannot edit the bill."))
|
||||
return redirect(url_for(".list_bills"))
|
||||
|
||||
if not form.errors:
|
||||
form.fill(bill, g.project)
|
||||
|
||||
return render_template("add_bill.html", form=form, edit=True)
|
||||
|
||||
|
||||
@main.route("/lang/<lang>")
|
||||
def change_lang(lang):
|
||||
|
|
Loading…
Reference in a new issue