'Warn if totals are not equal to 1.0
@ToDo: Handle deployment_settings which have Outcomes directly
attached to Projects'

def project_outcome_onaccept(self, form, create=False):

    db = current.db
    form_vars = form.vars
    record_id = form_vars.id
    table = current.s3db.project_outcome
    record = db((table.id == record_id)).select(table.goal_id, table.project_id, limitby=(0, 1)).first()
    try:
        project_id = record.project_id
    except:
        error = 'Cannot    find    Project    Outcome    record    (no    record    for    this    ID),    so    cannot    update    statuses    or    validate    weighting'
        current.log.error(error)
        current.session.error = error
        return
    if (not create):
        query = (((table.goal_id == record.goal_id) & (table.deleted == False)) & (table.id != record_id))
        records = db(query).select(table.weighting)
        total = 0
        for r in records:
            total += r.weighting
        total += form_vars.weighting
        if (total != 1.0):
            current.response.warning = current.T('Weightings    should    add    up    to    1.0')
    self.project_planning_status_update(project_id)
