Allow FV to be submitted without newly uploaded pdf
This commit is contained in:
parent
a84954799d
commit
1606bad016
@ -29,6 +29,9 @@ class BaseFinancialForm(ValidatedForm):
|
||||
"""
|
||||
self.uii_ids.process_data(self.uii_ids.data)
|
||||
|
||||
def validate(self, **kwargs):
|
||||
return super().validate()
|
||||
|
||||
def validate_draft(self):
|
||||
"""
|
||||
Another stupid workaround. Maybe there isn't a better way.
|
||||
@ -109,7 +112,18 @@ class ExtendedFinancialForm(BaseFinancialForm):
|
||||
def validate(self, *args, **kwargs):
|
||||
if self.funding_type.data == "OTHER":
|
||||
self.funding_type_other.validators.append(InputRequired())
|
||||
return super().validate(*args, **kwargs)
|
||||
|
||||
to_validator = None
|
||||
if kwargs.get("has_attachment"):
|
||||
to_validators = list(self.task_order.validators)
|
||||
self.task_order.validators = []
|
||||
|
||||
valid = super().validate(*args, **kwargs)
|
||||
|
||||
if to_validator:
|
||||
self.task_order.validators = to_validators
|
||||
|
||||
return valid
|
||||
|
||||
funding_type = SelectField(
|
||||
description="What is the source of funding?",
|
||||
|
@ -21,6 +21,7 @@ def fv_extended(_http_request):
|
||||
|
||||
|
||||
class FinancialVerificationBase(object):
|
||||
|
||||
def _get_form(self, request, is_extended, formdata=None):
|
||||
existing_fv_data = request.financial_verification
|
||||
|
||||
@ -153,7 +154,9 @@ class UpdateFinancialVerification(FinancialVerificationBase):
|
||||
should_submit = True
|
||||
updated_request = None
|
||||
|
||||
if not form.validate():
|
||||
attachment = self._process_attachment(self.is_extended, form)
|
||||
|
||||
if not form.validate(has_attachment=attachment):
|
||||
should_update = False
|
||||
|
||||
if not self.pe_validator.validate(self.request, form.pe_id.data):
|
||||
@ -164,8 +167,6 @@ class UpdateFinancialVerification(FinancialVerificationBase):
|
||||
self._apply_task_order_number_error(form.task_order_number)
|
||||
should_submit = False
|
||||
|
||||
attachment = self._process_attachment(self.is_extended, form)
|
||||
|
||||
if should_update:
|
||||
task_order = self._try_create_task_order(form, attachment)
|
||||
updated_request = Requests.update_financial_verification(
|
||||
|
Loading…
x
Reference in New Issue
Block a user