'Link Appraisal to Assignment'

@staticmethod
def hrm_appraisal_create_onaccept(form):

    mission_id = current.request.get_vars.get('mission_id', None)
    if (not mission_id):
        return
    id = form.vars.id
    db = current.db
    s3db = current.s3db
    atable = s3db.deploy_assignment
    hatable = db.hrm_appraisal
    hrtable = db.hrm_human_resource
    query = ((((hatable.id == id) & (hrtable.person_id == hatable.person_id)) & (atable.human_resource_id == hrtable.id)) & (atable.mission_id == mission_id))
    assignment = db(query).select(atable.id, limitby=(0, 1)).first()
    if (not assignment):
        return
    db.deploy_assignment_appraisal.insert(assignment_id=assignment.id, appraisal_id=id)
