settle button added

This commit is contained in:
MelodyZhangYiqun 2022-12-12 19:11:39 -05:00
parent 9d4873ed6e
commit 7ea7447db3

View file

@ -8,11 +8,11 @@ Basically, this blueprint takes care of the authentication and provides
some shortcuts to make your life better when coding (see `pull_project` some shortcuts to make your life better when coding (see `pull_project`
and `add_project_id` for a quick overview) and `add_project_id` for a quick overview)
""" """
import datetime
from functools import wraps from functools import wraps
import json import json
import os import os
from urllib.parse import urlparse, urlunparse from urllib.parse import urlparse, urlunparse
import datetime
from flask import ( from flask import (
Blueprint, Blueprint,
@ -810,8 +810,9 @@ def settle_bill():
bills = g.project.get_transactions_to_settle_bill() bills = g.project.get_transactions_to_settle_bill()
return render_template("settle_bills.html", bills=bills, current_view="settle_bill") return render_template("settle_bills.html", bills=bills, current_view="settle_bill")
@main.route("/<project_id>/settle/<amount>/<int:ower_id>/<int:payer_id>") @main.route("/<project_id>/settle/<amount>/<int:ower_id>/<int:payer_id>")
def settle(amount,ower_id,payer_id): def settle(amount, ower_id, payer_id):
# FIXME: Test this bill belongs to this project ! # FIXME: Test this bill belongs to this project !
# form = get_billform_for(g.project, set_default=False) # form = get_billform_for(g.project, set_default=False)
# form.bill_type = ("Refund", "Refund") # form.bill_type = ("Refund", "Refund")
@ -825,8 +826,8 @@ def settle(amount,ower_id,payer_id):
owers=[Person.query.get(payer_id)], owers=[Person.query.get(payer_id)],
payer_id=ower_id, payer_id=ower_id,
project_default_currency=g.project.default_currency, project_default_currency=g.project.default_currency,
bill_type= "Reimbursement", bill_type="Reimbursement",
what="settlement" what="settlement",
) )
session.update() session.update()
@ -837,6 +838,7 @@ def settle(amount,ower_id,payer_id):
# db.session.commit() # db.session.commit()
return redirect(url_for(".settle_bill")) return redirect(url_for(".settle_bill"))
@main.route("/<project_id>/history") @main.route("/<project_id>/history")
def history(): def history():
"""Query for the version entries associated with this project.""" """Query for the version entries associated with this project."""