submitting final financial verification is a top-level Requests method
This commit is contained in:
parent
f1ec71fe42
commit
217183c142
@ -232,7 +232,7 @@ WHERE requests_with_status.status = :status
|
|||||||
_TASK_ORDER_DATA = [col.name for col in TaskOrder.__table__.c if col.name != "id"]
|
_TASK_ORDER_DATA = [col.name for col in TaskOrder.__table__.c if col.name != "id"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_financial_verification(cls, request_id, financial_data, completed=False):
|
def update_financial_verification(cls, request_id, financial_data):
|
||||||
request = Requests._get_with_lock(request_id)
|
request = Requests._get_with_lock(request_id)
|
||||||
if not request:
|
if not request:
|
||||||
return
|
return
|
||||||
@ -249,9 +249,6 @@ WHERE requests_with_status.status = :status
|
|||||||
|
|
||||||
Requests._merge_body(request, {"financial_verification": request_data})
|
Requests._merge_body(request, {"financial_verification": request_data})
|
||||||
|
|
||||||
if completed:
|
|
||||||
Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL)
|
|
||||||
|
|
||||||
db.session.add(request)
|
db.session.add(request)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@ -264,3 +261,15 @@ WHERE requests_with_status.status = :status
|
|||||||
return TaskOrders.get(number)
|
return TaskOrders.get(number)
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def submit_financial_verification(cls, request_id):
|
||||||
|
request = Requests._get_with_lock(request_id)
|
||||||
|
if not request:
|
||||||
|
return
|
||||||
|
|
||||||
|
Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL)
|
||||||
|
|
||||||
|
db.session.add(request)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -39,10 +39,12 @@ def update_financial_verification(request_id):
|
|||||||
valid = form.perform_extra_validation(
|
valid = form.perform_extra_validation(
|
||||||
existing_request.body.get("financial_verification")
|
existing_request.body.get("financial_verification")
|
||||||
)
|
)
|
||||||
updated_request = Requests.update_financial_verification(request_id, form.data, completed=valid)
|
updated_request = Requests.update_financial_verification(request_id, form.data)
|
||||||
if valid:
|
if valid:
|
||||||
|
Requests.submit_financial_verification(request_id)
|
||||||
new_workspace = Requests.approve_and_create_workspace(updated_request)
|
new_workspace = Requests.approve_and_create_workspace(updated_request)
|
||||||
return redirect(url_for("workspaces.workspace_projects", workspace_id=new_workspace.id, newWorkspace=True))
|
return redirect(url_for("workspaces.workspace_projects", workspace_id=new_workspace.id, newWorkspace=True))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
form.reset()
|
form.reset()
|
||||||
return render_template(
|
return render_template(
|
||||||
|
@ -143,9 +143,3 @@ def test_update_financial_verification_with_invalid_task_order():
|
|||||||
Requests.update_financial_verification(request.id, request_financial_data)
|
Requests.update_financial_verification(request.id, request_financial_data)
|
||||||
assert not request.task_order
|
assert not request.task_order
|
||||||
|
|
||||||
|
|
||||||
def test_update_financial_verification_completed():
|
|
||||||
request = RequestFactory.create()
|
|
||||||
Requests.update_financial_verification(request.id, request_financial_data, completed=True)
|
|
||||||
assert request.status == RequestStatus.PENDING_CCPO_APPROVAL
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user