def run_check(self, model_instance, metadata): if not model_instance.signed_amendment: raise IssueFoundException( 'intervention {} type {} status {} has missing amendment file'.format( model_instance.intervention.id, model_instance.intervention.document_type, model_instance.intervention.status) )
def run_check(self, model_instance, metadata): if not model_instance.signed_amendment: raise IssueFoundException( 'agreement {} type {} status {} has missing amendment file'.format( model_instance.agreement.id, model_instance.agreement.agreement_type, model_instance.agreement.status ) )
def run_check(self, model_instance, metadata): master_user = metadata['master_user'] validator = InterventionValid(model_instance, master_user) if not validator.is_valid: raise IssueFoundException( 'intervention {} of type {} is invalid: (Status:{}), Errors: {}'.format( model_instance.id, model_instance.document_type, model_instance.status, ', '.join(validator.errors) ) )
def run_check(self, model_instance, metadata): wrong_cp = [] cp = metadata['cp'] if cp is None: logging.error( ( "Tried to check PD Outputs without a linked CountryProgramme for Intervention {}. " "This will be ignored and any associated issues may be resolved." ).format(model_instance.pk) ) return for rl in model_instance.result_links.all(): if rl.cp_output.country_programme != cp: wrong_cp.append(rl.cp_output.wbs) if len(wrong_cp) > 0: raise IssueFoundException( "PD [P{}] STATUS [{}] CP [{}] has wrongly mapped outputs {}".format( model_instance.id, model_instance.status, cp.wbs, wrong_cp) )
def run_check(self, model_instance, metadata): # in this case the queryset controls the issue, so all relevant objects should fail, # but we still need the test to be inside `run_check` so that objects can be rechecked # in the future fails_test = ( ( model_instance.agreement.agreement_type == Agreement.SSFA and model_instance.document_type == Intervention.PD ) or ( model_instance.agreement.agreement_type == Agreement.PCA and model_instance.document_type == Intervention.SSFA ) ) if fails_test: raise IssueFoundException( 'intervention {} type {} status {} has agreement type {}'.format( model_instance.id, model_instance.document_type, model_instance.agreement.agreement_type, model_instance.status ) )
def run_check(self, model_instance, metadata): if model_instance.name != metadata['expected_name']: raise IssueFoundException( 'Partner name "{}" does not match expected name "{}"!'.format( model_instance.name, metadata['expected_name']))
def run_check(self, model_instance, metadata): if not model_instance.short_name: raise IssueFoundException( 'Partner {} must specify a short name!'.format( model_instance.name))
def run_check(self, model_instance, metadata): if not model_instance.attached_agreement: raise IssueFoundException( '{} Agreement [{}] does not have a signed PCA attached'.format(model_instance.agreement_type, model_instance.id) )